wwwchen @ 2019-04-19 14:28:23
拜托
by wwwchen @ 2019-04-19 14:28:49
#include <iostream>
using namespace std;
int main() {
int n,k;
cin >> n >> k;
int smoke_l = 0;
int smoke = 0;
while(n--) {
smoke_l++;
++smoke;
if(smoke_l % k == 0) {
smoke_l = 0;
++smoke;
}
}
cout << smoke << endl;
return 0;
}
by wwwchen @ 2019-04-19 14:29:36
红题啊
by wwwchen @ 2019-04-19 14:30:10
c++
by TheLostWeak @ 2019-04-19 14:41:54
#include <iostream>
using namespace std;
int main() {
int n,k;
cin >> n >> k;
int smoke_l = 0;
int smoke = 0;
while(n--) {
smoke_l++;
++smoke;
if(smoke_l % k == 0) {
smoke_l = 0;//这里是不是应该为1啊?
++smoke;
}
}
cout << smoke << endl;
return 0;
}
by TheLostWeak @ 2019-04-19 14:42:16
@wwwchen
by wwwchen @ 2019-04-19 14:44:36
谢谢!
by wwwchen @ 2019-04-19 14:48:09
对的程序
#include <iostream>
using namespace std;
int main() {
int n,k;
cin >> n >> k;
int smoke_l = 0;
int smoke = 0;
while(n--) {
smoke_l++;
++smoke;
if(smoke_l % k == 0) {
smoke_l = 1;
++smoke;
}
}
cout << smoke << endl;
return 0;
}
感谢
满分了