3 solutions

  • 3
    @ 2023-12-22 21:59:52
    #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;
    }
    
    • 1
      @ 2023-9-17 16:21:33

      这是一个简单的做法

      #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;
      }
      
      • 0
        @ 2023-9-17 17:44:56
        
        

        #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; }

        
        
        • 1

        Information

        ID
        563
        Time
        1000ms
        Memory
        256MiB
        Difficulty
        3
        Tags
        # Submissions
        42
        Accepted
        25
        Uploaded By