QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#658863#7176. I Flipped The Calendar...sadatML 0ms0kbC++141.3kb2024-10-19 17:48:462024-10-19 17:48:47

Judging History

你现在查看的是最新测评结果

  • [2024-10-19 17:48:47]
  • 评测
  • 测评结果:ML
  • 用时:0ms
  • 内存:0kb
  • [2024-10-19 17:48:46]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define inp cin>>
#define out cout<<
#define ii >>
#define oo <<
#define nl <<"\n"
#define br cout<<"\n"
#define spc <<" "
#define space <<" "<<
#define loop(n) for(ll i=0; i<(n); i++)
#define fr(i,init, n) for(ll i=(init); i<(n); i++)



int numLeap(int year){ // inclusive 
	return (year / 4) - (year / 100) + (year / 400) ;
}

bool isleap(int year){
	if(year%400==0) return true;
	if(year%100==0) return false;
	if(year%4==0) return true;
	return false; 
}
int getrem(int year){
	year--;
	int days = year*365 + numLeap(year);
	int rem = days%7;


}

void SOLVE(){
	int year; inp year;
	int rem = getrem(year);


	int dayinmonth[]= {31,28,31,30,31,30,31,31,30,31,30,31}; 

	if(isleap(year)) dayinmonth[1]++;

	int m = 12;
	int ans =0;
	loop(m){
		int day = dayinmonth[i];
		if(rem<7) day+=rem;
		int week = day/7;
		rem = day%7;
		if(rem) week++;

		ans+=week;
	}


	out ans nl;

	





}   

signed main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int t=1;

	// cin>>t;///////////////////// 

	while(t--) SOLVE();
	return 0;
}


/*
starting day
number of days = 365*years + numleap

leap year
	divisible by 400 : true
	divisible by 100 : false
	by 4 : true
	false 

*/

详细

Test #1:

score: 0
Memory Limit Exceeded

input:

2023

output:


result: