274 条题解

  • 4
    @ 2017-10-27 20:54:08
    #include<iostream>
    using namespace std;
    int a[13];
    int main()
    {
        int sum=0,sum2=0;
        for(int i=0;i<12;i++)
        {
            cin>>a[i];
        }
        for(int i=0;i<12;i++)
        {
            sum+=300;
            sum-=a[i];
            if(sum<0)
            {
                cout<<"-"<<i+1<<endl;
                return 0;
            }
            sum2+=sum/100*100;
            sum%=100;
        }
        cout<<sum+sum2*1.2<<endl;
        return 0;
    }
    
  • 1
    @ 2019-09-17 21:12:03
    #include <stdio.h>
    
    int main()
    {
        int str[12];
        int i, money = 0, m = 0;
        for (i = 0;i < 12;i++) scanf("%d", &str[i]);
        for (i = 1;(money >= 0)&&(i<13);i++)
        {
            money += 300 - str[i - 1]; //当前月份剩的钱
            while ((money>=0)&&(money / 100))
            {
                money -= 100;
                m++;
            }
        }
        if (money >= 0) printf("%d\n", 120 * m + money);
        else printf("-%d\n", i-1);
    }
    
  • 1
    @ 2018-08-18 09:56:50

    绝对的一A

    #include<iostream>
    using namespace std;
    int main()
    {
        int y=0,ans=0,s=0,n,c=0;
        bool a=1;
        for(int i=1;i<=12;i++)
        {
            cin>>n;
            y=s+300;
            if(a&&y<n)
            {
                ans=i-i-i;
                a=0;
            }
            else
            {
                c+=(y-n)/100*100;
                s=(y-n)%100;
                y-=(y-n)/100*100;
                y-=n;
            }
        }
        if(a) cout<<c/100*120+s;
        else cout<<ans;
        return 0;
    }
    
  • 1
    @ 2018-08-18 09:56:32
    #include<iostream> 
    #include<cstdio>
    #include<cstdlib>
    #include<cmath>
    using namespace std;
    int main()
    {
        int i=0,x,y=0,a;
        float t=0;
        while(i<12)
        {
            ++i;
            cin>>x;
            if(300+y-x<0) 
            {
                cout<<"-"<<i;
                return 0;
            }
            a=(300+y-x)/100;
            t=t+1.2*100*a;
            y=300-100*a+y-x;
        }
        cout<<t+y;
        return 0;
    }
    
  • 1
    @ 2017-08-25 11:37:30

    #include <iostream>
    #include <cstdio>
    #include <cstring>
    #include <algorithm>
    #include <cstdlib>
    #include <cmath>
    #define pi 3.14159265358979
    #define eps 1e-10
    #define TN 50002
    using namespace std;
    int a[101];
    int ans,tt,l;
    int main()
    {
    for(int i=1;i<=12;i++) scanf("%d",&a[i]);
    for(int i=1;i<=12;i++)
    {
    ans+=300;
    if(ans<a[i]) {printf("-%d",i);return 0;}

    //if(ans-a[i]>=100)
    {l=(ans-a[i])/100;ans=(ans-a[i])%100;tt+=l*100;}
    }
    printf("%d",120*tt/100+ans);
    return 0;
    }

  • 1
    @ 2017-05-08 07:52:04

    暴力模拟就好啦~

    #include <iostream>
    #include <cstdio>
    #include <algorithm>
    #include <cstring>
    #include <iomanip>
    #include <cstdlib>
    using namespace std;
    
    int a[13];
    int b;
    int n;
    
    int main()
    {
        for(int i=1;i<=12;i++)
            cin>>a[i];
        for(int i=1;i<=12;i++)
        {
            b+=300;
            if(b<a[i])
            {
                cout<<-i<<endl;
                return 0;
            }
            else
                b-=a[i];
            while(b>=100)
                {b-=100,n++;}
        }
        cout<<n*120+b<<endl;
        return 0;
    }
         
    
  • 1
    @ 2017-05-01 11:23:30

    注意加上没有存进储蓄的自己手里的钱……低级错误

    #include<iostream>
    using namespace std;
    
    int main()
    {
        int ys,money,chux=0;
        for (int i=1;i<=12;i++)
        {
            cin>>ys;
            money=300+money-ys;
            if (money<0)
            {
            cout<<-i;
            return 0;
            }
            if (money>=100)
            {
                chux=chux+money-money%100;
                money%=100;
            }
        }
        cout<<chux*120/100+money;
        return 0;
    }
    
    • @ 2017-11-06 19:57:50

      谢谢。。。

  • 1
    @ 2017-03-29 20:12:21

    #include<stdio.h>
    int main()
    {
    int year[12];
    int money=0;
    int mom=0;
    for(int i=0;i<12;i++)
    {
    scanf("%d",&year[i]);
    }
    for(int i=0;i<12;i++)
    {
    money+=300;
    if(money>=year[i])
    {
    money-=year[i];
    if(money>=100)
    {
    mom+=money-money%100;
    money-=money-money%100;
    }
    else
    {
    money+=0;
    }
    }
    else
    {
    printf("-%d",i+1);
    return 0;
    }
    }
    money+=(mom/100)*120;
    printf("%d",money);
    }

  • 0
    @ 2020-06-29 13:06:36

    此题略水。纯枚举,用好整除和求模运算,不会太难的。另外,注意别模0,否则,你懂得。。。

    代码如下:
    ```
    01.var i,s,p,z:integer;

    02. a:array[1..12]of integer;

    03. tt:real;

    04. f:boolean;

    05.begin

    06. s:=0;p:=0;z:=0;f:=true;

    07. for i:=1 to 12 do begin

    08. readln(a[i]);

    09. s:=s+300-a[i];

    10. if(s<0)and f then begin
    11. z:=i;
    12. f:=false;
    13. end;
    14. if s>=100 then begin

    15. p:=p+(s div 100)*100;

    16. s:=s mod 100;

    17. end;

    18. end;

    19. tt:=s+p*1.2;

    20. if z=0 then writeln(tt:0:0)

    21. else writeln('-',z);

    22.end.

  • 0
    @ 2020-03-17 19:27:13
    #include<iostream>
    using namespace std;
    
    int month[12];
    
    int main() {
        int mother = 0;
        int jingjing = 0;
        
        for(int i = 0 ; i < 12 ; ++i) {
            cin >> month[i];    
        }
        
        for(int i = 0 ; i < 12 ; ++i) {
             jingjing = jingjing + 300 - month[i];  
             if(jingjing < 0) {
                cout << "-"<<i + 1<<endl;
                return 0;
             }          
             
             while(jingjing >= 100) {
                jingjing -= 100;
                mother += 100;
             }
        }
        
        cout << 1.2 * mother + jingjing << endl; 
        return 0;   
        
    } 
    
  • 0
    @ 2019-12-10 19:36:33

    #include <iostream>
    using namespace std;

    int main() {
    int money = 0;
    int store = 0;
    int i = 0;
    int moneyNeedNow = 0;
    int moneyWillStore = 0;
    int flag = 0;//不够
    while (i++ < 12) {
    cin >> moneyNeedNow;
    money = money+ 300- moneyNeedNow;
    if (money >= 100) {
    moneyWillStore = 100 * (money / 100);
    money -= moneyWillStore;
    store += moneyWillStore;
    }
    else if (money < 0) {
    flag = 1;
    break;
    }
    }
    if (flag == 1) {
    cout << "-" << i << endl;
    }
    else {
    cout << money + store * 1.2 << endl;
    }
    return 0;
    }

  • 0
    @ 2019-02-21 16:40:36

    #include <stdio.h>

    int main()
    {
    int money[12],i=0;
    int in=0,out=0,total,con=1,month,TotalOut=0;
    for (i=0; i<12;i++)
    {
    scanf("%d",&money[i]);
    }
    i=0;
    for (i=0;i<12;i++)
    {
    in+=300;
    in-=money[i];
    if (in<0)
    {
    month=i+1;
    con=0;
    break;
    }
    out=in-in%100;
    TotalOut+=out;
    in-=out;
    }
    if (con==1)
    {
    total=in+TotalOut*1.2;
    printf("%d",total);
    }
    else
    {
    printf("-%d",month);
    }
    return 0;
    }

  • 0
    @ 2018-12-27 21:54:29
    #Python 解法,请多指教
    def process(budget, balance, Mama):
    
        if balance + 300 - budget >= 100:
            Mama = 100 * ((balance + 300 - budget) // 100) + Mama
            balance = (balance + 300 - budget) % 100
        
             
        else:
            balance = balance + 300 - budget
        return balance, Mama
    
    
    balance = 0
    Mama = 0
    
    for i in range(1, 13):
        budget = int(input())
        balance, Mama = process(budget, balance, Mama)
        
        if balance < 0:
            print("-{}".format(i))
            break
        if i == 12:
            print(int(Mama*1.2 + balance))
        i = i + 1
        
    
  • 0
    @ 2018-11-03 21:06:38

    c++代码
    #include<bits/stdc++.h>
    using namespace std;
    int main(){
    int a,s=0,t=0;
    for(int i=1;i<=12;i++){
    cin>>a;
    s=s+300-a;
    if(s<0){
    cout<<"-"<<i;
    return 0;
    }
    if(s>=100){
    t=t+s/100*100;
    s=s-s/100*100;
    }
    }
    cout<<fixed<<setprecision(0)<<s+t*1.2;
    return 0;
    }

  • 0
    @ 2018-10-20 12:09:55

    program jingjing;
    var n,ans,m,i:longint;
    a:array[1..12] of longint;
    begin
    n:=0;
    ans:=0;
    m:=0;
    for i:=1 to 12 do
    readln(a[i]);
    for i:=1 to 12 do
    begin
    n:=n+300-a[i];
    if n<0 then
    begin
    m:=-i;
    writeln(m);
    exit;
    end;
    if n>100 then
    begin
    ans:=ans+n div 100;
    n:=n mod 100;
    end;
    end;
    n:=n+ans*120;
    writeln(n);
    end.

  • 0
    @ 2018-10-20 12:09:08

    program jingjing;
    var a:array [1..12] of longint;
    yuan,cun,c1,c2,i,n:longint;
    begin
    yuan:=0;
    for i:=1 to 12 do
    readln(a[i]);
    for i:=1 to 12 do
    begin
    yuan:=yuan+300-a[i];
    if yuan<0 then
    begin n:=-i; writeln(n); exit; end;
    if yuan>=100 then
    begin
    cun:=cun+yuan div 100;
    yuan:=yuan mod 100;
    end;
    end;
    cun:=cun*120;
    yuan:=yuan+cun;
    writeln(yuan);
    end.

  • 0
    @ 2018-10-14 22:33:52

    #include<iostream>
    #include<math.h>
    using namespace std;
    int a[13] = { 0 };
    struct money
    {
    int moneyToMum = 0;
    int remain[13] = {0};
    }jing;
    int main()
    {
    int j = 1;
    for (int i = 1; i <= 12; i++)
    cin >> a[i];
    while(j <= 12)
    {
    jing.remain[j] = jing.remain[j - 1] + 300 - a[j];
    if (jing.remain[j] < 0)
    {
    cout << "-" << j;
    return 0;
    }
    if (jing.remain[j] >= 100)
    {
    int temp;
    temp = jing.remain[j] % 100;
    jing.moneyToMum += jing.remain[j]-temp;
    jing.remain[j]=temp;
    }
    j++;
    }
    cout << jing.remain[12] + jing.moneyToMum + jing.moneyToMum*0.2;
    return 0;
    }

  • 0
    @ 2018-08-26 13:51:01
    nowm = 0
    savem = 0
    for i in range(1,13):
        tmp = int(input())
        nowm += 300
        if tmp > nowm:
            print("-{}".format(i))
            exit()
        else:
            nowm -= tmp
            savem += (nowm // 100)
            nowm %= 100
    nowm += savem * 120
    print(nowm)
    

    python 就是简洁

  • 0
    @ 2018-08-18 18:01:25

    p党标程
    var
    i,s,x,bank:longint;
    begin
    for i:=1 to 12 do
    begin
    s:=s+300;
    readln(x);
    if s<x then
    begin
    writeln(-i);
    halt;
    end;
    s:=s-x;
    bank:=bank+s div 100;
    s:=s mod 100;
    end;
    writeln(bank*120+s);
    end.

  • 0
    @ 2018-08-09 19:39:09

    托儿索来助你们一臂之力
    var

    s,h,t,i:longint;

    begin

    s:=0;

    h:=0;

    for i:=1 to 12 do
    begin

    read(t);

    inc(s,300);

    if t>s then
    begin
    write('-',i);
    exit;
    end;

    inc(h,(s-t) div 100);

    dec(s,(s-t) div 100*100+t);

    end;

    write(s+h*120);

    end.

信息

ID
1096
难度
5
分类
模拟 点击显示
标签
递交数
15271
已通过
5420
通过率
35%
被复制
9
上传者