Optimal trade

1 #include<iostream> 2 #include<cstdio> 3 using namespace std; 4 const int maxn=1e5+7; 5 const int maxm=5e5+7; 6 const int inf=0x7f7f7f7f; 7 int n,m,num; 8 int head[maxn],val[maxn],f[maxn],mi[maxn]; 9 int read(){ 10 int f=1;int x=0;char s=getchar(); 11 while(s<'0'||s>'9') {if(s=='-') f=-1;s=getchar();} 12 while(s>='0'&&s<='9'){x=x*10+s-'0';s=getchar();} 13 x*=f; 14 return x; 15 } 16 struct Edge{ 17 int next,to; 18 }edge[maxm]; 19 void add(int from,int to){ 20 edge[++num].next=head[from]; 21 edge[num].to=to; 22 head[...

Print all strings according to dictionary order.

For example, to ABC To print ABC, ACB, BAC, BCA, cab, CBA. void AA(char* pStr,char* pBegin) { if(*pBegin == '\0') cout << pStr << endl; else { for(char* ptemp = pBegin;*ptemp != '\0';ptemp++) { if(ptemp != pBegin) { char a = *ptemp; *ptemp = *pBegin; *pBegin = a; } AA(pStr,pBegin+1); if(ptemp != pBegin) { char a = *ptemp; *ptemp = *pBegin; *pBegin = a; } ...

[WPF] WPF MVVM simple example

1 New WPF application WPFMVVMExample The program structure is shown in the following figure.     2 ModelRealization Under the Model folder, create a new Business Class StudentModel (Class File StudentModel. cs), and the detailed code for the class is shown below. using System.ComponentModel; namespace WPFMVVMExample.Model { public class StudentModel : INotifyPropertyChanged { /// <summary> /// School number/// </summary> private int studentId; public int StudentId { get { return studen...

Eclipse’s server window can’t add solutions like tomcat6.0 and other versions.

Correct method windows->perferences Delete all the options. These are the Tomcats you deleted after you added them. One doesn’t leave. Restarting eclipse after deleting solves the problem Problem solving can be added. Failure method There is no such directory in my eclipse4.3 directory..metadata/.plugins/org.eclipse.core.runtime/.settings】 1.  Close Eclipse  2.  Open the location of WorkSpace. {workspace-directory}/.metadata/.plugins/org.eclipse.core.runtime/.settings Delete the following files org.eclipse.jst.server.tomcat.core.prefs org.eclipse.wst.server.core.prefs    3....

Analog examples

1.UVa 11300 State compression, enumerating the state of the first row for check. #include<bits/stdc++.h> #define rep(i,x,y) for(register int i=x;i<=y;i++) #define dec(i,x,y) for(register int i=x;i>=y;i--) #define ll long long using namespace std; const int N=20; const int inf=0x3f3f3f3f; inline int read(){ int x=0,f=1;char ch=getchar(); while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();} while(isdigit(ch)){x=(x<<1)+(x<<3)+(ch^48);ch=getchar();} return x*f;} int kase,n; int a[N][N],b[N][N]; inline int check(int s){ memset(b,0,sizeof b); for(int ...

Built in functions in Python

This article is used to record built-in functions in Python. andIts functions are supplemented at any time. Complete built-in functions and their descriptions are available in the official documentation: https://docs.python.org/3.5/library/functions.html Universal built in function:     id() Function: look at the memory address of the object;     help()Function: view help information;     type()Function: look at the type of the object; do not think that the subclass is a parent type.     isinstance()Function: view object type; think subclass is a kind of parent...

Your level does not depend on how many questions you solve, but depends on how you think. When you are trying to solve a problem, you should first think independently. If you really don’t have any ideas, you should read others’solutions bit by bit rather than all at once, making sure you have as much as possibleYou made it yourself. After that, think carefully about why you can’t think of those parts that depend on the solution. Do not copy other people’s code. Everyone has his unique way of solving problems — Mao Xiao. Mao thought an interesting translation of &...

An idea

I thought about it for a while after class, and found something.   $$n = \prod_{i = 1} ^ m p_i ^ {a_i}$$ $$f(n) = \sum_{i = 1} ^ m a_i$$ Given $n < 998244353$, how many numbers are there from $1$to $n$, which satisfies $f (I) $even.   With an odd number of $x $and an even number of $y $obviously $x + y = n$, if you can construct a linear combination of $x, y $and easily calculate its value, you can solve the problem. Just when I studied the sieve, I knew there was such a function: $$\lambda(n) = (-1) ^ {\sum_{i = 1} ^ m a_I}$$ Consider the meaning of $T = 1_ sum {i = 1} ^ n_ lambda (i) $...