网易的模拟卷

牛客商网易2017春季实习生招聘模拟卷第二个编程题,就是歌手发布专辑那道题,只通过了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;
}

#网易#
全部评论

相关推荐

09-21 21:14
门头沟学院
否极泰来来来来:和他说:这里不好骂你,我们加个微信聊
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务