官方数据自测90,ccf0分
查看原帖
官方数据自测90,ccf0分
492030
CityFish楼主2023/10/31 20:33

请各位帮忙看看,谢谢了

#include <bits/stdc++.h>

using namespace std;

const int maxn = 1e9+10;

int n,cnt,day = 1,tar,j;
bool vis[maxn];

int main(){
	freopen("apple.in","r",stdin);
	freopen("apple.out","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>n;
	int i = 0;
	while(cnt < n){
		i++;
		if(i > n){
			day++;
			i = 1;
			j = 0;
		}
		if(vis[i])
			continue;
		j++;
		if(j % 3 == 1){
			vis[i] = true;
			cnt++;
			if(i == n) tar = day;
		}
	}
	cout<<day<<" "<<tar<<endl;
}
2023/10/31 20:33
加载中...