2 条题解

  • 1
    @ 2024-10-29 11:27:55
    #include<bits/stdc++.h>
    using namespace std;
    
    int main() {
        int budget, money = 0, interest = 0;
        for (int i = 1; i <= 12; i++) {
            cin >> budget;
            money += 300 - budget;
            if (money < 0) {
                cout << '-' << i;
                return 0;
            }
            while (money >= 100) {
                interest += 100;
                money -= 100;
            }
        }
        cout << money + interest * 1.2;
        return 0;
    }
    
    • 0
      @ 2024-11-10 10:40:30
      #include <iostream>
      using namespace std;
      int main(){
      	int d,y,c=0,l=0;
      	for(int i=1;i<=12;i++){
      	    cin>>d;
      	    y=l+300-d;
      	    c=c+y/100;
      	    l=y%100;
      	    if(y<0){
      	        cout<<-i;
      	        return 0;
      	    }	
      	}
      	cout<<c*100*1.2+l<<endl;
      	return 0;
      }
      
      • 1

      信息

      ID
      5147
      时间
      1000ms
      内存
      125MiB
      难度
      1
      标签
      递交数
      536
      已通过
      241
      上传者