6 条题解

  • 11
    @ 2023-11-25 20:58:29
    #include <iostream>
    using namespace std;
    int main()
    {
        int a , b = 0 , c = 0 , d = 0 , e;
        for(int i = 1;i <= 12;i++)
        {
            cin >> a;
            b = b + 300;
            if(b < a)
            {
                c = 0 - i;
                break;
            }
            else
            {
                b = b - a;
            }
            if(b >= 100)
            {
                d += b - b % 100;
                b = b % 100;
            } 
        }
        if(c != 0)
        {
            cout << c;
        }
        else
        {
            e = b + d + d / 5;
            cout << e;
        }
        return 0;
    }
    
    • 2
      @ 2023-7-22 17:39:05

      yasuo

      你说他怎么在最后一天把所有钱都给mum,就像199明明就差1,他却只给100,全给还能多得20%*99约=20%*100=20块=巨款👀️ ,Dsb

      #include <iostream>
      int main(){
          int money=0,money_mum=0,spend;
          for(int i=1;i<=12;i++){
              std::cin>>spend;
              money+=300-spend;
              if(money<0){std::cout<<-1*i;return 0;}
              else {money_mum+=money/100*100;money-=money/100*100;}}
          std::cout<<1.2*money_mum+money;return 0;}
      
      • 1
        @ 2023-6-23 1:08:33
        #include <bits/stdc++.h>
        using namespace std;
        int main()
        {
            int p,h,o=0,flag=1,t=0,m;
            for(int i=1;i<=12;i++)
            {
                cin>>p;
                o=o+300-p;
                if(o<0&&flag==1)
                {
                    h=i;
                    flag=0;
                }
                m=o/100;
                o=o-m*100;
                t=t+m*100;
            } 
            if(flag==0)	cout<<-1*h;
            else cout<<o+(t*6)/5;
            return 0;
        }
        
        
        • 0
          @ 2024-5-26 20:53:35
          #include<iostream>
          using namespace std;
          int main()
          {
              int x,a=0,b=0,sum=0;
              bool flag=1;
              for(int i=1;i<=12;i++)
              {
                  a+=300;
                  cin >> x;
                  if(x<=a)
                  {
                      if(a-x >=100)
                      {
                          b+=a-x-(a-x)%100;
                          a-=a-x-(a-x)%100;
                      }
                  }
                  else
                  {
                      flag=0;
                      a=-i;
                      break;
                  }
                  a-=x;
              }
              if(flag)
              {
                  sum=a+b*1.2;
              }
              else
              {
                  sum=a;
              }
              cout << sum;
              return 0;
          }
          
          • 0
            @ 2024-4-5 22:37:07
            #include<bits/stdc++.h>
            using namespace std;
            int main(){
            	int x=0,n,m=0,c=0;		
            	for(int x=1;x<=12;x++)	{// 十二个月 
            		cin>>n;			   	// 输入每个月预算 
            		m=m+300-n;			// 余钱 
            		c=c+m/100;			// 存入c个整百到妈妈手上 
            		m=m%100;			// 存入后剩下得钱  
            		if(m<0){		    // 钱不够 小于0 
            			cout<<-x;		//输出当前-月份 结束程序 
            			return 0;			
            		}
            	}
            	cout<<m+100*c*1.2;		// 年末输出全部钱 
            	return 0;
            }
            

            😄 🎉️ 🎉️ 🎉️ 😄

            • 0
              @ 2023-7-15 18:30:19

              本题我采用模拟法 a 表示手里的钱 s 表示存妈妈那里的钱 z是状态码

              #include<iostream>
              #include<iomanip>
              #include<cmath>
              using namespace std;
              int main()
              {
                  int a=0,s=0,z=0;
                  for (int i=1;i<=12;i++)
                  {
                      a+=300;///每月拿300元
                      int b;
                      cin>>b;
                      a-=b;
                      if (a<0)///不够花
                      {
                          cout<<"-"<<i;
                          z=1;
                          break;
                      }
                      if (a/100>0)///判断手中的钱
                      {
                          s+=a/100*100;
                          a=a-a/100*100;
                      }
              
                  }
                  if (z==0)
                  {
                      cout<<1.2*(1.0*s)+a;
                  }
                  return 0;
              }
              
              • 1

              信息

              ID
              178
              时间
              1000ms
              内存
              128MiB
              难度
              5
              标签
              递交数
              5775
              已通过
              1287
              上传者