| ||||||||||
| 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 | |||||||||
我的天啊,这题wa 了我两天了,这么简单,但是为什么连sample第三个数据都过不了????#include<iostream>
using namespace std;
int main()
{
int a,b,c,d,e,f,g,h,i;
int p1,p2,p3;
int n = 0,n_num;
int num;
//int aa[100000];
int j;
cin>>n_num;
while (n<n_num)
{
n++;
cin>>a>>b>>c>>d>>e>>f>>g>>h>>i;
//aa[0] = a;
//aa[1] = b;
//aa[2] = c;
p1 = a;
p2 = b;
p3 = c;
for (j = 3; j<=i; j++)
{
if (j%2!=0)
{
num = d*p3+e*p2-f*p1;
p1 = p2;
p2 = p3;
if (num<0)
{
p3 = g+num%g;
}
else
p3 = num%g;
}
else
{
num = f*p3-d*p2+e*p1;
p1 = p2;
p2 = p3;
if (num<0)
{
p3 = h+num%h;
}
else
p3 = num%h;
}
}
if (i==0)
cout<<a<<endl;
if (i==1)
cout<<b<<endl;
if (i==2)
cout<<c<<endl;
if (i>=3)
cout<<p3<<endl;
}
return 0;
}
////////////////////////////
Sample Input
3
1 2 3 4 5 6 7 8 9
11 12 13 14 15 16 17 18 19
321 322 323 324 325 326 327 328 329
Sample Output
4
0
308///题目是90
//////////////////////////
到底是怎么回事啊,大牛指点下啦~~,小弟感激!!~~
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator