K - Downgrade Gym - 101775K
作者:互联网
题目大意:一天不玩相当于A-B中将A转换为经验值,B舍弃掉,然后A=1,在通过升级所需要的经验值来判断可以升几级
题目连接:https://codeforces.com/gym/101775/problem/K
AC代码:
#include<bits/stdc++.h> using namespace std; const int N=1E5+7; int arr[N]; int main(){ int t; scanf("%d",&t); for(int i=1;i<=t;i++){ memset(arr,0,sizeof(arr)); int a,b,day; scanf("%d%d%d",&a,&b,&day); for(int j=1;j<=a;j++) scanf("%d",&arr[j]); int a1=a; int b1=b; while(day--){ b1=a1; a1=1; for(int j=1;j<=a;j++){ if(b1>arr[j]){ b1-=arr[j]; a1++; } else break; } if(a1==1&&b1==1) break; } printf("Case #%d: %d-%d\n",i,a1,b1); } return 0; }
标签:break,arr,int,Gym,101775K,a1,b1,Downgrade,经验值 来源: https://www.cnblogs.com/Accepting/p/11622832.html