Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
为什么用printf输出就WA,改用stringstream,然后一起输出就AC了#include <iostream> #include <sstream> using namespace std; char haab[][10]={"pop","no","zip","zotz","tzec","xul","yoxkin","mol","chen","yax","zac","ceh","mac","kankin","muan","pax","koyab","cumhu","uayet"}; char tzolkin[][10]={"imix","ik","akbal","kan","chicchan","cimi","manik","lamat","muluk","ok", "chuen","eb","ben","ix","mem","cib","caban","eznab","canac","ahau"}; int ha[999]; int main() { stringstream mystream; int test,i,j,k; for (i=0;i!=19;i++) { int sum=0; for (j=0;j!=strlen(haab[i]);j++) { sum+=haab[i][j]; } ha[sum]=i; } scanf("%d",&test); //这里 //printf("%d\n",test); mystream<<test<<endl; for (i=0;i!=test;i++) { int hday,hmonth,hyear,allday; char hm[10]; double a; scanf("%lf%s%d",&a,hm,&hyear); hday=int(a); int s=0; for (j=0;j!=strlen(hm);j++) s+=hm[j]; hmonth=ha[s]; allday=hyear*365+hmonth*20+hday; int tnum,tday,tyear; tyear=allday/260; allday%=260; tday=allday%20; tnum=allday%13+1; //这里 //printf("%d %s %d\n",tnum,tzolkin[tday],tyear); mystream<<tnum<<" "<<tzolkin[tday]<<" "<<tyear<<endl; } cout<<mystream.str(); return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator