#include <cstdio> #include <vector> #include <cstring> #include <algorithm> #include <iostream> using namespace std; int main() { int t,kase=1; string org,ans,tmp1,tmp2; scanf("%d",&t); getchar(); while(t–) { getline(cin,ans); getline(cin,org); if(org.size()==ans.size()) { bool f=0; for(int i=0;i<org.size();i++) { if(org[i]!=ans[i]) { f=1;break; } } if(f) printf("Case %d: Wrong Answer\n",kase++); else printf("Case %d: Yes\n",kase++); } else { tmp1="";tmp2=""; for(int i=0;i<org.size();i++) { if(org[i]!='
Category: String
11588
#include <iostream> #include <cstdio> #include <sstream> #include <string> #include <cstring> using namespace std; int arr[27]; int main() { int t,ans; int kase=1; char ch; int R,C,M,N; cin>>t; while(t–) { cin>>R>>C>>M>>N; memset(arr,0,sizeof(arr)); for(int i=0;i<R*C;i++) { cin>>ch; arr[ch-'A']+=1; } int mx=-1; for(int i=0;i<26;i++) { if(arr[i]>mx) mx=arr[i]; } int cnt=0; for(int i=0;i<26;i++) { if(arr[i]==mx) cnt+=1; } ans=mx*cnt*M+(R*C-mx*cnt)*N; cout<<"Case
11687
#include <iostream> #include <cstdio> #include <sstream> #include <string> using namespace std; int main() { int n,cnt; string s,t; stringstream ss; while(cin>>s) { if(s=="END") break; n=s.size(); cnt=1; ss.clear(); ss<<n; ss>>t; while(s!=t) { s=t; n=s.size(); ss.clear(); ss<<n; ss>>t; cnt+=1; } cout<<cnt<<"\n"; } return 0; }
12243
Need to know a little more about string.char an locale library. #include <iostream> #include <cstdio> #include <cstring> #include <string> #include <locale> using namespace std; int main() { string str; locale loc; while(getline(cin,str)) { if(str=="*") break; char ch1; char ch=str[0]; if(isupper(ch,loc)) ch1=tolower(ch,loc); else ch1=toupper(ch,loc); //cout<<ch<<" "<<ch1<<"\n"; bool tautogram=1; for(int i=1;i<str.size();i++) { if(str[i]==' ') { if(i+1<str.size() &&
196
#include <iostream> #include <cstring> #include <cstdlib> #include <cstdio> #include <cctype> #include <string> #include <cmath> #include <sstream> using namespace std; string str[1000][18279]; int val[1000][18279]; bool isDone[1000][18279]; int C,R; int solve(int a,int b) { if(isDone[a][b]) return val[a][b]; string tmpstr; for(int i=0;i<str[a][b].size();i++) { if(str[a][b][i]=='=' || str[a][b][i]=='+') { str[a][b][i]=' '; } } stringstream ss; ss<<str[a][b]; int sum = 0;
622
#include <iostream> #include <string.h> #include <cstring> #include <vector> #include <cstdio> #include <stack> #include <queue> #include <algorithm> #define ll long long using namespace std; int error; string valu,res; int isOprtr(char c) { if(c=='+' || c=='-') return 1; if(c=='*' || c=='/' ||c=='%') return 2; return 0; } //1*(2+3*23+12*34)+3 = 482 //1*(2+3*23+12*34)+3*(4+5*65-13+8-2) = 1445 //2+3*(2+2-1+3+(12+12*3)+3+4) //1*2+3*23+12*34+3*4+5*65-13+8-2 //((20*((((((((100)))))))*100))) int
490
#include <iostream> #include <string.h> #include <fstream> using namespace std; char s[105][105]; int main() { int k=0; int len,mx=0; //ofstream out; //out.open("out.txt"); for(int i=0;i<105;i++) for(int j=0;j<105;j++) s[i][j]=' '; while(gets(s[k])) { len = strlen(s[k]); s[k][len] =' '; if(len>mx) mx = len; k++; } for(int j=0;j<mx;j++) { for(int i=k-1;i>=0;i–) { cout<<s[i][j]; //out<<s[i][j]; } cout<<endl; //out<<endl; } //out.close(); return
12403
#include <iostream> #include <stdio.h> #include <string.h> using namespace std; int main() { int t,n; char str[100],s[20]; cin>>t; getchar(); int sum=0; while(t–) { gets(str); if(strcmp(str,"report")==0) { sprintf(s,"%d",sum); puts(s); } else { sscanf(str,"%s %d",s,&n); sum+=n; } } return 0; }
12541
#include <iostream> #include <sstream> #include <stdio.h> #include <string> #include <math.h> using namespace std; int main() { int n; double max_,min_; double day,month,yr; string s,name,young,old; stringstream ss; bool f=false; cin>>n; //getchar(); while(n–) { cin>>name>>day>>month>>yr; yr+=((month/12)+(day/365)); if(!f) { max_=yr; young = name; min_=yr; old = name; f=1; } else { if(yr>max_) { max_=yr; young = name; }
12543
#include <iostream> #include <string> #include <math.h> using namespace std; int main() { string s,maxStr,a; int max_=0; int len=0; maxStr=""; while(cin>>s) { if(s=="E-N-D") break; len=0; a=""; for(int i=0;i<s.size();i++) { if((s[i]>='a' && s[i]<='z') || (s[i]>='A' && s[i]<='Z') || s[i]=='-') { len++; if(s[i]>='A' && s[i]<='Z') a.append(1u,s[i]+32); else a.append(1u,s[i]); } } if(len>max_) { max_=len; maxStr=a; } } cout<<maxStr<<"\n"; return