SOS

P1568 赛跑

怎么了
by Monkey_Hunter @ 2020-02-14 12:58:03


???
by hjxhjx @ 2020-02-14 12:58:53


???
by Charlie查理 @ 2020-02-14 13:05:31


您是写到一半家里停电了么?(逃
by qjyzLfy @ 2020-02-14 13:07:50


楼上过于真实
by Islauso @ 2020-02-14 13:08:13


我认为楼上说的太对了,楼下你怎么看?(逃
by 青鱼Official @ 2020-03-03 11:17:26


额,事实上是网卡了,(我自己都不知道 为什么我的代码是90分 ```cpp #include <iostream> using namespace std; int main() { int a,b,c = 0,time1 = 0; cin >> a >> b; int one[a][2],two[b][2]; for(int i = 0;i < a + b;i++) { if(i < a) { cin >> one[i][0] >> one[i][1]; time1 += one[i][1]; } else { cin >> two[i - a][0] >> two[i - a][1]; } } int em1[time1],em2[time1]; int who[time1]; for(int i = 0;i < a;i++) { for(int j = 0;j < one[i][1];j++) { if(c == 0) { em1[c] = one[0][0]; } em1[c] = em1[c - 1] + one[i][0]; c++; } } c = 0; for(int i = 0;i < b;i++) { for(int j = 0;j < two[i][1];j++) { if(c == 0) { em2[c] = two[0][0]; } em2[c] = em2[c - 1] + two[i][0]; c++; } } c = 0; if(em1[0] > em2[0]) { who[0] = 1; } else if(em1[0] < em2[0]) { who[0] = 2; } else { who[0] = 0; } for(int i = 1;i < time1;i++) { if(em1[i] > em2[i]) { who[i] = 1; } else if(em1[i] < em2[i]) { who[i] = 2; } else { who[i] = 0; } if(who[i] != who[i - 1] && who[i] != 0) { c++; } } cout << c; return 0; } ```
by 林楚颜 @ 2020-04-20 13:53:09


|