005:雇佣兵
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
int M, N, X, n,nsume;
cin >> M >> N >> X;
while (X) {
if (M % N)
X -= M / N + 1;
else
X -= M / N;
if (X < 0)
break;
N += M / N;
}
cout << N;
return 0;
}
006:数字统计
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
int l, r,t=0;
cin >> l >> r;
for (int i = l;i <= r;i++) {
int temp = i;
while (temp) {
if (temp % 10 == 2)
t++;
temp /= 10;
}
}
cout << t;
return 0;
}