3 条题解

  • 5
    @ 2023-10-10 21:09:13
    #include<stdio.h>
    int main() {
    	int a[15],i,n,m,s,x;
    	scanf("%d",&n);
    	while(n--) {
    		m=0;
    		s=0;
    		x=0;
    		for(i=0;i<12;i++) {
    			scanf("%d",&a[i]);
    		}
    		for(i=0;i<12;i++) {
    			m+=300;
    			s++;
    			if(m<a[i])
    				break;
    			else
    				m=m-a[i];
    			if(m>=100) {
    				x+=m/100;
    				m=m%100;
    			}
    		}
    		if(s==12)
    			printf("%d\n",x*120+m);
    		else
    			printf("-%d\n",s);
    	}
    	return 0;
    }
    
    • 1
      @ 2025-11-8 18:39:28
      #include <stdio.h>
      int main(){
          int a;
          scanf("%d",&a);
          while(a--){
              int m,i=1,b=0,save=0,judge=0;
              double sum=0;
              while(i<=12){
                  scanf("%d",&m);
                  if(m<=300+b){
                      b=300+b-m;
                      while(b>=100){
                          b-=100;
                          save+=100;
                      }
                  }
                  else {printf("-%d\n",i);judge=1;}
                  i++;
              }
              sum=save*1.2;
              if(judge==0)printf("%.0f\n",sum+b);
          }
      }
      
      • 0
        @ 2025-11-25 21:01:17
        #include<stdio.h>
        int main()
        {
            int n;
            scanf("%d",&n);
            while(n--)
            {
                int flag=0;
                int a[13];
                for(int i=1;i<=12;i++)
                {
                    scanf("%d",&a[i]);
                }
                int shengyu=0;
                int tem=0;
                for(int i=1;i<=12;i++)
                {
                    shengyu=shengyu+300-a[i];
                    if(shengyu<0)
                    {
                       printf("-%d\n",i);
                       flag=1;
                       break;
                    }
                    if(shengyu>=100)
                    {
                        tem=tem+shengyu/100;
                        shengyu=shengyu%100;
                    }
                }
                if(flag)
                {
                    continue;
                }
                int total=(int )(tem*100+tem*100*0.2+0.5+shengyu);//别忘了加上剩下的钱 0.5用于四舍五入
                printf("%d\n",total);
            }
            return 0;
        }
        
        • 1

        信息

        ID
        139
        时间
        3000ms
        内存
        128MiB
        难度
        8
        标签
        (无)
        递交数
        1706
        已通过
        234
        上传者