「CF460A」Vasya and Socks
题解
数据范围这么小怎么搞都行吧
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
#include<iostream> #include<cstdio> #include<algorithm> #include<cmath> #include<queue> #include<vector> #include<map> #include<cstdlib> #define inf 1000000000 #define linf 9000000000000000000LL #define ll long long using namespace std; inline int read() { int x=0,f=1;char ch=getchar(); while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();} while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();} return x*f; } int n,m,ans; int main() { n=read();m=read(); ans=n; while(n/m) { ans+=n/m; n=n/m+n%m; } printf("%d",ans); return 0; } |
Subscribe