| ||||||||||
| 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:结果都对了,就是说是wrong answer,是不是我超时还是说是其他的错误啊,救命啊!In Reply To:结果都对了,就是说是wrong answer,是不是我超时还是说是其他的错误啊,救命啊! Posted by:zhyuan16 at 2005-05-09 16:16:21 最好编译到Release试一下行不行
没有初值就写 (p = e = i = d) != -1 的习惯很不好
> //C++语言编写,只会C的哥们应该看得懂,与C不同的就是里面的输入输出不同,哥哥们救哈我啊
> #include < iostream >
> using namespace std;
>
> void compute ()
> {
> const int physical = 23;
> const int emotional = 28;
> const int intellectual = 33;
> int p,e,i,d;
> int num = 1;
> while ( (p = e = i = d) != -1 )
> {
> cin>>p>>e>>i>>d;
> if ( (p == -1)&&(e == -1)&&(i == -1)&&(d == -1) )
> {
> break;
> }
> int x;
> for ( x = 1;;x++)
> {
> if ( ((x-p)%physical == 0) && ((x-e)%emotional == 0) && ((x-i)%intellectual == 0 ) )
> break;
> }
> cout<<"Case "<<num<<" : the next triple peak occurs in "<< x - d <<" days.";
> num ++;
> }
> }
>
> int main ()
> {
> compute ();
> return 0;
> }
>
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator