本文共 913 字,大约阅读时间需要 3 分钟。
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 338 Accepted Submission(s): 212
3 73 64 9
Case #1: 3Case #2: 1Case #3: 2
1 #include2 using namespace std; 3 typedef long long ll; 4 int main() 5 { 6 ll n,m; 7 ll p=1; 8 while(scanf("%lld%lld",&n,&m)!=EOF) 9 {10 printf("Case #%lld: ",p++);11 if(m<=n)12 {13 printf("%lld\n",m);14 continue;15 }16 ll c=m-n;17 if(c%(2*(n-1))==0)18 {19 printf("%lld\n",n);20 continue;21 }22 if(c%(2*(n-1))<=n-1)23 printf("%lld\n",c%(2*(n-1)));24 else25 {26 ll k=c%(2*(n-1))%(n-1);27 printf("%lld\n",k);28 }29 }30 return 0;31 }
转载地址:http://spfea.baihongyu.com/