练习时长2秒半的蒟蒻24pts求助
查看原帖
练习时长2秒半的蒟蒻24pts求助
283541
harvey2019楼主2022/10/23 18:44
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef float fl;
typedef double dou;
typedef long double ld;
#define register int ri;

const ll inf = 1e9;
const ll inf_common = 0x3f3f3f3f;
const ll inf_larger = 0x7fffffff;
const ll inf_ll = 1e18;
const ll mod = 1e9 + 7;
const ll mod1 = 998244353;
const dou eps = 1e-6;

inline ll read()
{
	ll ans = 0;
	ll f = 1;
	char c = getchar();
	
	while( c < '0' || c > '9' )
	{
		if( c == '-' )
		{
			f = -1;
		}
		
		c = getchar();
	}
	
	while( c >= '0' && c <= '9' )
	{
		ans = ( ans << 3 ) + ( ans << 1 ) + ( c - 48 );
		c = getchar();
	}
	
	return ans * f;
}

inline void write( ll x )
{
	if( x < 0 )
	{
		putchar( '-' );
		x = -x;
	}
	
	if( x > 9 )
	{
		write( x / 10 );
	}
	
	putchar( x % 10 + '0' );
}

int dpm[] = { 31 , 28 , 31 , 30 , 31 , 30 , 31 , 31 , 30 , 31 , 30 , 31 };
int times_day[11] = {0};

int main()
{
	int n = read();
	int i = 0;
	int xq = 0;
	int year = 0;
	
	for( year = 1990 ; year < 1990 + n ; year++ )
	{
		for( i = 0 ; i < 12 ; i++ )
		{
			times_day[xq]++;
			xq = ( xq + dpm[i] + ( ( i == 2 ) && ( ( year % 100 || year % 400 == 0 ) && year % 4 == 0 ) ) ) % 7;
		}
	}
	
	for( i = 0 ; i < 7 ; i++ )
	{
		write( times_day[i] );
		putchar( ' ' );
	}
	
	return 0;
}
2022/10/23 18:44
加载中...