【HDU】6043 - KazaQ's Socks(思维)
2017-07-26 09:25
411 查看
题目链接:点击打开题目
这个写一串例子就知道规律了。
代码如下:
这个写一串例子就知道规律了。
代码如下:
#include<queue> #include<cmath> #include<stack> #include<cstdio> #include<vector> #include<cstring> #include<iostream> #include<algorithm> using namespace std; typedef long long LL; #define INF 0x3f3f3f3f #define CLR(a,b) memset(a,b,sizeof(a)) #define PI acos(-1.0) int main() { LL n,k; int Case = 1; while (~scanf ("%lld %lld",&n,&k)) { printf ("Case #%d: ",Case++); if (n == 2) { printf ("%lld\n",((k-1)%2)+1); continue; } if (k <= n) printf ("%lld\n",k); else { k -= n - 1; LL ant = ((k-1) / (n-1)) + 1; LL rest = ((k-1) % (n-1)) + 1; if (rest == 1) printf ("%lld\n",(ant & 1) ? n : n-1); else printf ("%lld\n",rest-1); } } return 0; }
相关文章推荐
- 2017杭电多校联赛 1011 KazaQ's Socks(找规律)HDU 6043
- 【多校训练】hdu 6043 KazaQ's Socks
- 17 多校 - 1 - 1011 - KazaQ's Socks (HDU 6043)
- HDU 6043 KazaQ's Socks【规律】
- HDU 6043 KazaQ's Socks
- 17暑假多校联赛1.11 HDU 6043 KazaQ's Socks
- hdu 6043 KazaQ's Socks 模拟
- 2017 Multi-University Training Contest - Team 1:KazaQ's Socks(hdu 6043)
- HDU 6043 KazaQ's Socks - 2017多校联盟1 第11题 -规律
- HDU 6043 KazaQ's Socks(暑期训练1011)
- HDU 6043(2017 多校训练赛1 1011) KazaQ's Socks
- HDU 6043 KazaQ's Socks
- HDU 6043(KazaQ's Socks) 规律题 Java
- HDU 6043 KazaQ's Socks(水~)
- HDU 6043 KazaQ's Socks 找规律
- HDU 6043 KazaQ's Socks 【规律】
- HDU 6043 KazaQ's Socks(周期)
- (数学)HDU 6043 KazaQ's Socks
- hdu-多校训练赛-KazaQ's Socks
- hdu 6043 KazaQ's Socks