| ||||||||||
| 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 | |||||||||
Re:帮忙看看哪里错了In Reply To:Re:帮忙看看哪里错了 Posted by:19850910 at 2005-03-04 22:55:12 这儿干吗要定义 y为数组阿
> int d[20],m[20],y[20],amount,d1,m1,y1;
然后循环:
> for(int j=0;j<t;j++)
> {
>
> for(int i=0;i<19;i++)
> {
> m[j]=i+1;
> if(!(strcmp(month[j],mon1[i]))) break;
> }
这儿y[j]就可能溢出阿,不用数组也可以吧
> amount=y[j]*365+(m[j]-1)*20+d[j]+1;
> y1=(amount-1)/260;
> m1=(amount%260)%20;
> d1=(amount%260)%13;
> if(m1==0) m1=20;
> if(d1==0) d1=13;
> cout<<d1<<" "<<mon2[m1-1]<<" "<<y1<<endl;
> }
>
> return 0;
> }
>
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator