救命,第一个-7对了,第二个输出-12

P1089 [NOIP2004 提高组] 津津的储蓄计划

# 用for循环不就行了吗? ```cpp #include<bits/stdc++.h> using namespace std; int main(){ int a,b=0,c; for(int i=1;i<=12;i++){ cin>>a; c+=300-a; if(c<0){ cout<<"-"<<i<<endl; return 0; } while(c/100!=0){ b++; c-=100; } } cout<<b*120+c<<endl; return 0; } ```
by 123123bao @ 2022-06-07 21:26:48


|