摘要:“Miku is matchless in the world!” As everyone knows, Nakano Miku is interested in Japanese generals, so Fuutaro always plays a kind of card game about
阅读全文
摘要:A.2295 求有多少素数对和等于n。 暴力。 #include <bits/stdc++.h> using namespace std; int ss(int n) { int i=2,a=sqrt(n); for(;i<=a;i++) if(n%i==0) return 0; return 1;
阅读全文
摘要:A.2805 N*M的图,每次浇水(X1,Y1)-(X2,Y2)围成的矩形,问最后有多少点被浇水了。 暴力。 #include<bits/stdc++.h> using namespace std; bool g[245][245]; int main() { int X,Y,I; cin>>X>>
阅读全文
摘要:A.3232 n个物品,换取要花积分,问刚好花完积分能换最大多少价值的物品。 多重背包。 #include <bits/stdc++.h> using namespace std; int t[1005]; int main() { int m,n,i,a,b,c,T,j,k; scanf("%d"
阅读全文
摘要:A.3583 n根木棍是否能分成相等两堆。 背包dp,首先求和sum,如果为偶数就说明不行,否则考虑做一个sum/2大小的背包。 1 #include<bits/stdc++.h> 2 using namespace std; 3 4 int main() 5 { 6 int n,w[105]; 7
阅读全文
摘要:A.3132 给一个有向图,问能否从任意点出发都能进入一个环中。 深搜。 #include<bits/stdc++.h> using namespace std; const int N=55; vector<int>G[N]; bool vis[N]; int f; void dfs(int u)
阅读全文
摘要:A.2176 给一个字符串s,问距离为D的字母对是否存在相同。 模拟。 #include<bits/stdc++.h> using namespace std; int main() { string s,b; while(cin>>s) { if(s[0]=='*')break; int flag
阅读全文