280 条题解

  • 0
    @ 2017-03-30 15:49:34

    WHAT A PITY!
    #include<stdio.h>
    int main()
    {
    int month[13]={0};
    int j=0,mom=0,i;
    float all;
    for(i=1;i<13;i++)
    scanf("%d",&month[i]);
    for(i=1;i<13;i++)
    {
    j=300-month[i];
    if(j<0)
    {
    printf("-%d",i);
    return 0;
    }
    mom=j/100*100;
    j=j%100;
    }
    all=mom*1.2+j;
    printf("%g",all);
    }

  • 0
    @ 2017-03-29 23:30:44
    #include<iostream>
    int main()
    {
        int consume[12];
        int store = 0;
        for (int i = 0; i < 12; i++)
        {
            std::cin >> consume[i];
        }
        int amount=0;
        for (int i = 0; i < 12; i++)
        {
            amount =amount+ 300 - consume[i];
            if (amount < 0)
            {
                std::cout <<-1*( i + 1);
                return 0;
            }
            store =store + amount - amount % 100;
            amount %= 100;
        }
        std::cout << store*120/100 + amount;
        return 0;
    }
    
  • 0
    @ 2017-02-17 15:22:04

    #include<stdio.h>
    #include<stdlib.h>
    #include<math.h>
    int a,ans,Ans;
    int main()
    {
    int i=1;
    for(;i<=12;i++)
    {
    scanf("%d",&a);
    Ans+=(ans+300-a)/100*100;
    if(ans+300-a<0) {printf("-%d",i);return 0;};
    ans=(ans+300-a)%100;
    }
    if(i==13) printf("%g",ans+Ans*1.2);
    return 0;
    }

  • 0
    @ 2017-02-02 16:54:19

    #include<iostream>
    using namespace std;
    int main()
    {
    int a[12],b[12];
    int s,i,k;
    k=0;
    s=0;
    for(i=0;i<12;i++)
    {
    cin>>a[i];
    s=s+300-a[i];
    k=k+s/100;
    b[i]=s;
    if(s>=100)
    {
    s%=100;
    b[i]=s;
    }
    }
    for(i=0;i<12;i++)
    { if(b[i]<0)
    {
    cout<<-(i+1)<<endl;
    break;
    }
    if((i==11)&&(b[i]>0))
    cout<<(k*120+s)<<endl;
    }
    return 0;
    }

  • 0
    @ 2016-12-22 21:50:48

    又是浮点数惹的祸。。。乘以1.2要注意了,还是直接除100再乘120吧。。。。
    ```c++
    #include<cstdio>
    #include<cstring>
    #include<cmath>
    int main()
    {
    int n,yu = 0,a=0;
    int sum = 0;
    for(int i=1;i <= 12;i++)
    {
    scanf("%d",&n);
    if(yu + 300 - n < 0) {printf("-%d\n",i);a = 1;break;}
    if(yu + 300 - n >= 100) {sum += ((300+yu-n)/100)*100;yu = yu +300-n-(((300+yu-n)/100)*100);}
    else yu = yu + 300 - n;
    // printf("sum = %d yu = %d\n",sum,yu);
    }
    if(a == 0){printf("%d\n",(sum/100)*120 + yu);}

    return 0;
    }

  • 0
    @ 2016-11-26 00:05:29

    #include<stdio.h>
    #define N 12

    int main()
    {
    int money[N];
    int sum=0,sum1=0;
    int x=0,i,n;
    for(i=0;i<N;i++)
    {
    scanf("%d",&money[i]);
    }
    for(i=0;i<12;i++)
    {
    x = x+300;
    if(x<money[i])
    {
    printf("-%d",i+1);
    return 0;
    }
    else
    {
    sum = x - money[i];
    n = sum/100;
    sum1 = sum1+ n*100;
    x = sum - n*100;
    }
    }

    sum1 = sum1*1.2 + x;
    printf("%d",sum1);

    }

  • 0
    @ 2016-11-09 21:40:51

    #include <iostream>
    #include <algorithm>
    #include <cstdio>
    #include <cstring>
    #include <cstdlib>
    #include <cmath>
    #include <map>
    #include <vector>
    #include <stack>
    #include <queue>

    using namespace std;

    int a,b;

    int main(){
    for(int i=1;i<=12;i++){
    a=a+299+scanf("%d",&a)-a;
    if(a<0)return printf("%d\n",-i)&0;
    b+=a/100;a%=100;
    }
    printf("%d\n",a+b*120);
    }

  • 0
    @ 2016-11-03 21:57:20

    #include<iostream>
    #include<cstdio>
    #include<cstring>
    #define N 14
    using namespace std;
    int tot;
    int haisheng[N];
    int hua[N];
    int main()
    {
    ios::sync_with_stdio(false);
    for(int i=1;i<=12;i++)
    cin>>hua[i];
    for(int i=1;i<=12;i++)
    {
    haisheng[i] = 300 + haisheng[i-1]-hua[i];
    if(haisheng[i]<0)
    {
    cout<<"-"<<i<<endl;
    return 0;
    }
    tot += (haisheng[i]/100)*100;
    haisheng[i] = haisheng[i]%100;

    }

    cout<<haisheng[12]+tot*1.2;
    return 0;
    }

  • 0
    @ 2016-10-26 22:05:55
    #include <iostream>
    using namespace std;
    int main()
    {
        int a[13],b[13],c[13],sum=0;
        int i,key=0,k;
        b[0]=0;
        c[0]=0;
        for(i=1;i<13;i++)
            cin>>a[i];
        for(i=1;i<13;i++)
        {  
            c[i]=(300-a[i]+b[i-1])/100;//存的钱
            b[i]=(300-a[i]+b[i-1])%100;//留下的钱
            sum+=c[i];
            if(a[i]>300+b[i-1])
            {
                cout<<-(i);
                key=1;
                break;
            }
        }
        if(key==0)
        cout<<sum*120+b[12];//注意要加上12月手上剩的钱,不然会死得很惨!
        return 0;
    }
    

  • 0
    @ 2016-09-04 22:22:58
    #include<cstdio>
    using namespace std;
    int main()
    {
        int a[13];
        for (int i=1;i<=12;i++) scanf("%d",&a[i]);
        a[0]=0;
        int x=0,f=0;
        for (int i=1;i<=12;i++){
            a[i]=a[i-1]+300-a[i];
            if (a[i]>=0){
                x+=a[i]-(a[i]%100);
                a[i]=a[i]%100;
            }
            else {
                printf("-%d\n",i);
                f=1;break;
            }
        }
        if (!f) printf("%d\n",(x/100)*120+a[12]);
        return 0;
    }
    
  • 0
    @ 2016-08-13 17:23:49
    #include<iostream>
    #include<cstdio>
    
    using namespace std;
    int main()
    {
        int mother_bank=0;
        int XMmon_banl=0;
        int XMcost;
        int god_month=0;
        cout<<1<<":";
        for(int i=1;i<=12;i++)
        {
            cin>>XMcost;
            XMmon_banl+=300;
            if(XMmon_banl<XMcost&&god_month==0)
            {
                god_month = i;
                XMmon_banl = 0;
                continue;
            }
            XMmon_banl -= XMcost;
            mother_bank += (XMmon_banl/100)*100;
            XMmon_banl %= 100;
            cout<<"母亲: "<<mother_bank;
            cout<<"小明剩余: "<<XMmon_banl<<endl<<endl;
            cout<<i+1<<":";
        }
        if(god_month>0)
            cout<<-god_month<<endl;
        else
        {
            double ans;
            ans = XMmon_banl + mother_bank;
            cout<<"mother's: "<<mother_bank<<endl;
            cout<<"XMmon_banl's: "<<XMmon_banl<<endl;
            ans += 0.2*ans;
            cout<<ans<<endl;
        }
        return 0;
    }
    
    
    

    /*
    290
    230
    280
    200
    300
    170
    140
    50
    90
    80
    200
    60

    */
    1:290
    母亲: 0小明剩余: 10

    2:230
    母亲: 0小明剩余: 80

    3:280
    母亲: 100小明剩余: 0

    4:200
    母亲: 200小明剩余: 0

    5:300
    母亲: 200小明剩余: 0

    6:170
    母亲: 300小明剩余: 30

    7:140
    母亲: 400小明剩余: 90

    8:50
    母亲: 700小明剩余: 40

    9:90
    母亲: 900小明剩余: 50

    10:80
    母亲: 1100小明剩余: 70

    11:200
    母亲: 1200小明剩余: 70

    12:60
    母亲: 1500小明剩余: 10

    13:mother's: 1500
    XMmon_banl's: 10
    1812

    Process returned 0 (0x0) execution time : 1.899 s
    Press any key to continue.

  • 0
    @ 2016-08-13 11:52:27

    #include<iostream>
    #include<cstdio>
    using namespace std;
    int main()
    {
    int mother_bank=0;
    int XMmon_banl=0;
    int XMcost;
    int god_month=0;
    for(int i=1;i<=12;i++)
    {
    cin>>XMcost;
    XMmon_banl+=300;
    if(XMmon_banl<XMcost&&god_month==0)
    {
    god_month = i;
    XMmon_banl = 0;
    continue;
    }
    XMmon_banl -= XMcost;
    mother_bank += (XMmon_banl/100)*100;
    XMmon_banl %= 100;
    }
    if(god_month>0)
    cout<<-god_month<<endl;
    else
    {
    double ans;
    ans = XMmon_banl + mother_bank;
    cout<<mother_bank<<endl;
    cout<<XMmon_banl<<endl;
    ans += 0.2*ans;
    cout<<ans<<endl;
    }
    return 0;
    }
    为啥会娃。。。。它要求加上剩下的钱20%是 :(妈妈存的那整百的钱)*0.2,还是津津小金库的剩下的钱*0.2,还是(妈妈存的那整百的钱 + 津津小金库的剩下的钱)*0.2;

  • 0
    @ 2016-07-13 22:13:27

    弱爆啊!

    var x,i,s,j:longint;
    begin
    for i:=1 to 12 do
    begin
    readln(x);
    s:=s+300-x;
    if s<0 then
    begin
    writeln('-',i);
    halt;
    end;
    j:=j+s div 100;
    s:=s mod 100;
    end;
    if j>0 then writeln(j*120+s);
    end.

  • 0
    @ 2016-07-12 20:00:09

    #include<cstdio>
    #include<iostream>
    using namespace std;
    int main(){
    int i;
    int money[13];
    for(i=1;i<=12;i++){
    cin>>money[i];
    }
    int now=0,save=0,flag=0;
    for(i=1;i<=12;i++){
    now=now+300;
    if(now<money[i]){
    flag=i;
    break;
    }
    int temp=(now-money[i])/100;
    save=save+temp*100;
    now=now-money[i]-temp*100;
    }
    if(flag){
    cout<<"-"<<flag;
    return 0;
    }
    int left=(save/100)*120+now;//实数直接不能赋给整数
    cout<<left;
    return 0;
    }

  • 0
    @ 2016-07-11 10:27:39

    小数运算误差
    #include <cstdio>

    int main(){
    #ifdef DEBUG
    freopen("in.txt","r",stdin);
    #endif
    int a[13];
    for(int i=1;i<=12;i++)
    scanf("%d",&a[i]);
    int now=0,save=0,flag=0;
    for(int i=1;i<=12;i++){
    now+=300;
    if(now<a[i]){
    flag=i;
    break;
    }
    int temp=(now-a[i])/100;
    save+=temp;
    now-=100*temp+a[i];
    }
    if(flag){
    printf("-%d",flag);
    return 0;
    }
    save*=120;
    printf("%d",save+now);

    return 0;
    }

  • 0
    @ 2016-02-17 23:27:48

    发个垃圾题解:
    c++
    #include<stdio.h>
    int m=0,n=0,x;
    int main(){
    for(int i=0;i<12;++i){
    n+=300; scanf("%d",&x);
    if(x>n) return 0&printf("-%d",i+1);
    m+=(n-x)/100*100; n=(n-x)%100;
    }
    printf("%d",m/5*6+n);
    }

  • 0
    @ 2015-12-06 19:38:41

    program ssa;
    var
    a:array[1..15]of integer;
    i,n,b,m:integer; c:real;
    begin
    assign(input,'save.in');
    reset(input);
    assign(output,'save.out');
    rewrite(output);
    for i:=1 to 12 do
    read(a[i]);
    for i:=1 to 12 do
    begin
    n:=n+300-a[i];
    if n>99 then begin m:=(n div 100)*100; b:=b+m; n:=n-m; end;
    if n<0 then begin writeln('-',i); break; end;
    end;
    if n>0 then begin c:=n+b*1.2; writeln(c:0:0) end;
    close(input);
    close(output);
    end.

  • 0
    @ 2015-11-22 17:32:14

    #include<Stdio.h>
    int a[15],b[15],i,c,d=1;
    float x=0;
    int main()
    {
    for(i=1;i<=12;i++)
    {
    scanf("%d",&a[i]);
    if(300-a[i]+b[i-1]>=0)
    {
    if(300-a[i]+b[i-1]>=100)
    {
    x=x+(((300-a[i]+b[i-1])/100)*100);//x=总钱
    b[i]=300-a[i]+b[i-1]-(((300-a[i]+b[i-1])/100)*100);//b是上个月留下的钱
    }
    else
    {
    b[i]=300-a[i]+b[i-1];
    }
    }
    else
    {
    d=-500;
    b[14]=i;break;
    }
    }
    x=x*1.2+b[12];
    c=x;
    if(d==1)
    {
    printf("%d",c);
    }
    else if(d==-500)
    printf("%d",-b[14]);
    return 0;
    }
    无比丑陋的题解

  • 0
    @ 2015-11-04 10:29:42

    #include <iostream>

    void Proc1();
    int main()
    {
    Proc1();
    return 0;
    }
    void Proc1()
    {
    using namespace std;
    int Mother=0, Month[13] = { 0 }, budget[12];
    for (int i = 0; i < 12; i++)
    cin >> budget[i];
    for (int i = 1; i <= 12; i++)
    {

    Month[i] = Month[i - 1] + 300;
    if (Month[i] < budget[i - 1])
    {
    cout << '-' << i;
    return;
    }
    Mother += (Month[i] - budget[i - 1])/100 *100;
    Month[i] = (Month[i]-budget[i-1]) % 100;
    }
    cout << Mother / 5 * 6+Month[12] << endl;
    }

  • 0
    @ 2015-10-30 20:07:14

    program ex;
    var a:array[1..1000]of longint;
    jy,b,n,k,i,j,ans,x:longint;
    m:real;
    begin
    for i:=1 to 12 do
    read(a[i]);
    for i:=1 to 12 do
    begin
    a[13]:=300+jy;
    if a[13]<a[i] then
    begin
    x:=-i;
    write(-i);
    exit;
    end;
    if a[13]>=a[i] then
    begin
    ans:=300-a[i]+jy;
    jy:=ans mod 100;
    n:=n+ans div 100;
    end;
    end;
    m:=n*100*1.2+jy;
    if x=0 then
    write(m:0:0);
    end.

    • @ 2015-10-30 20:11:37

      倒数第四行m:=n*100*1.2+jy;

    • @ 2015-10-30 20:12:01

      100乘以1.2

信息

ID
1096
难度
5
分类
模拟 点击显示
标签
递交数
16002
已通过
5681
通过率
36%
被复制
38
上传者