网易的模拟卷
牛客商网易2017春季实习生招聘模拟卷第二个编程题,就是歌手发布专辑那道题,只通过了90%,求问是有什么比较奇怪的测试集没通过么,或者有没有做过的小伙伴发个代码来看一下。
我随便写了一个,通过了90%,不知道错在哪:
#网易#我随便写了一个,通过了90%,不知道错在哪:
#include <iostream>
using namespace std;
int main(){
int n = 0, s = 0, L = 0;
while (cin >> n >> s >> L){
int nums = L / (s + 1);
int sec = L % (s + 1);
if (sec == 0){
if (nums % 13 == 0) --nums;
}
else{
if (sec == s){
++nums;
if (nums % 13 == 0) --nums;
}
else{
if (nums % 13 == 0) --nums;
}
}
int total = n / nums + ((n%nums) ? 1 : 0);
cout << total << endl;
}
return 0;
}
