lsksndnx @ 2020-11-29 21:51:10
#include <stdio.h>
int main()
{
int n, m, ans, i, j = 0, x;
scanf("%d%d", &n, &m);
i = n;
ans = n;
x = n;
while(i >= m) {
x = i / m;
j = i % x;
i = x + j;
ans = ans + x;
}
printf("%d\n", ans);
return 0;
}
by c60521c @ 2020-11-29 22:34:47
一位过了毒瘤黑题的在求助仅9行代码的红题
by c60521c @ 2020-11-29 22:40:52
AC Code:
using namespace std;
int main()
{
int n,m;
scanf("%d %d",&n,&m);
printf("%d",n+(n-1)/(m-1));
return 0;
}//要剪掉最后一根烟蒂
数据1: 4 3 5 四个烟,四个烟蒂,3烟蒂换一烟 2: 10 3 14 10烟蒂,换3根,再3烟蒂,再换
by c60521c @ 2020-11-29 22:49:28
黑题嫌疑很大(明日我危
by lsksndnx @ 2020-12-02 19:52:54
@c60521c 你回复我了?我怎么都不知道
by c60521c @ 2020-12-02 19:54:14
@lsksndnx ?
by HLL2067140806 @ 2021-01-12 16:29:21
看看我这个叭,大佬们```cpp
using namespace std; int main() { int n, m; cin >> n >> m; if (n < m) { cout << n; return 0; } int sum = 0; sum += n; int s2 = n; while(s2>=m) { int s = s2 / m; sum += s; s2 = n % m; s2 += s; } cout << sum; }
by justinjia @ 2021-02-08 14:10:07
@HLL2067140806