Usaco1.1 friday

/*
ID: ljfcnya1
PROG: friday
LANG: C++
*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<vector>
#include<algorithm>

using namespace std;

#define REP(i, a, b) for(int i = (a), _end_ = (b);i <= _end_; ++ i)
#define mem(a) memset((a), 0, sizeof(a))
#define str(a) strlen(a)

const int maxn = 10000;

int n, m;

void read(int &x) {
    x = 0;
    char c = getchar();
    while(c < '0' || c > '9')
        c = getchar();
    while(c >= '0' && c <= '9') {
        x = x * 10 + c - '0';
        c = getchar();
    }
}

int date[13] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}, ans[8];

int main() {
    freopen("friday.in", "r", stdin);
    freopen("friday.out", "w", stdout);
    scanf("%d", &n);
    int today = 0;
    REP(i, 1900, 1900 + n - 1) {
        if((i % 4 == 0 && i % 100 != 0) || (i % 400 == 0))
            date[1] = 29;
        else
            date[1] = 28;
        REP(j, 0, 11)   
            REP(k, 1, date[j]) {
                ++today;
                if(k == 13)
                    ++ans[today];
                if(today == 7)
                    today = 0;  
            }
    }
    printf("%d %d", ans[6], ans[7]);
    REP(i, 1, 5)
        printf(" %d", ans[i]);
    puts("");
    return 0;
}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值