2017 Multi-University Training Contest - Team 1 1011&&HDU 6043 KazaQ's Socks【规律题,数学,水】

KazaQ's Socks

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)
Total Submission(s): 338    Accepted Submission(s): 212

2017 Multi-University Training Contest - Team 1 1011&&HDU 6043 KazaQ's Socks【规律题,数学,水】

Sample Input
3 7
3 6
4 9
Sample Output
Case #1: 3
Case #2: 1
Case #3: 2
Source
分析:
2017 Multi-University Training Contest - Team 1 1011&&HDU 6043 KazaQ's Socks【规律题,数学,水】
然后分别去判断即可!详细请看代码。
下面给出AC代码:
 #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
ll n,m;
ll p=;
while(scanf("%lld%lld",&n,&m)!=EOF)
{
printf("Case #%lld: ",p++);
if(m<=n)
{
printf("%lld\n",m);
continue;
}
ll c=m-n;
if(c%(*(n-))==)
{
printf("%lld\n",n);
continue;
}
if(c%(*(n-))<=n-)
printf("%lld\n",c%(*(n-)));
else
{
ll k=c%(*(n-))%(n-);
printf("%lld\n",k);
}
}
return ;
}
上一篇:2017 Multi-University Training Contest - Team 9 1002&&HDU 6162 Ch’s gift【树链部分+线段树】


下一篇:SharedPreferences漏洞, 无法避免,所以不要在里面存储敏感信息