标签:
A题#include <iostream> #include <stdio.h> using namespace std; int main() { int n,i; while(cin>>n) { bool flag = false; while(n--) { cin>>i; if(i==1) flag=true; } cout<<(flag?-1:1)<<endl; } return 0; }
#include <iostream> #include <stdio.h> using namespace std; int main() { int a,b,c,d,e,f; while(cin>>a>>b>>c>>d>>e>>f) printf("%d\n",(a+b+c)*(a+b+c)-a*a-c*c-e*e); return 0; }
#include <iostream> using namespace std; string solve(string k) { if(k.length()%2) return k; string m = solve(k.substr(0,k.length()/2)); string n = solve(k.substr(k.length()/2,k.length())); if(m < n) return n+m; return m+n; } int main() { string a,b; cin>>a>>b; cout<<(solve(a) == solve(b)?"YES":"NO")<<endl; return 0; }
版权声明:转载请注明出处
标签:
原文地址:http://blog.csdn.net/k183000860/article/details/47090283