查看原帖
914923
scc36楼主2025/1/22 19:37

很迷惑为什么会这样……
本人思路就是七天七天加,加到超过为止。
于是有了以下程序:

#include <bits/stdc++.h>
using namespace std;
unsigned long long n,i,t,s,j;
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	cin>>n;
	for(i=1;;i++){
		t+=7;
		s+=i*7;
		if(s>=n) break;
	} 
	for(j=1;j<=7;j++){
		if(s<=n){
			cout<<t;
			return 0;
		} 
		t--,s-=i;
	}
	cout<<t;
}

很明显能过样例,但每一个数据点都少了一,不知道为什么……
是数据出问题了,还是我的程序出问题了?
救救孩子(ノへ ̄、)

2025/1/22 19:37
加载中...