Teacher Mai has an integer x.
He does the following operations k times. In the i-th operation, x
becomes the least integer no less than x, which is the multiple of i.
He wants to know what is the number x now.
标签:
#include<iostream> #include<cstdio> #include<cstring> #include<algorithm> using namespace std; typedef long long qword; int main() { freopen("input.txt","r",stdin); qword n,m; int i; qword t; int cnt=0; while (scanf("%lld%lld",&n,&m),cnt++,n+m) { t=0; for (i=1;i<=m;i++) { n=(n/i+(n%i!=0))*i; if (n/i==t)break; t=n/i; } printf("Case #%d: %lld\n",cnt,m*t); } }
bzoj 3858: Number Transformation
标签:
原文地址:http://www.cnblogs.com/mhy12345/p/4219765.html