3 solutions
-
3
- 1
Information
- ID
- 563
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 3
- Tags
- # Submissions
- 42
- Accepted
- 25
- Uploaded By
这是一个简单的做法
#include <iostream>
using namespace std;
int a[12],totm=0,tot=0;
int main(){
for(int i=0;i<=11;i++){
tot+=300;
cin>>a[i];
if(tot-a[i]<0){
cout<<"-"<<i+1<<endl;
return 0;
}
tot-=a[i];
while(tot>100) tot-=100,totm+=100;
}
cout<<1.2*totm+tot<<endl;
return 0;
}
#include using namespace std; int a[12],totm=0,tot=0; int main(){ for(int i=0;i<=11;i++){ tot+=300; cin>>a[i]; if(tot-a[i]<0){ cout<<"-"<<i+1<<endl; return 0; } tot-=a[i]; while(tot>100) tot-=100,totm+=100; } cout<<1.2*totm+tot<<endl; return 0; }
By signing up a ZXOJ universal account, you can submit code and join discussions in all online judging services provided by us.