3451:【例82.1】不吉利日期
[例82.1] 不吉利日期
不吉利的日期(PAT)
不吉利的日期(PAT)_在国外,每月的13号和每周的星期5都是不吉利的。特别是当13号那天恰好是星期5时,更-CSDN博客
OpenJudge NOI 1.13 02:不吉利日期
【信息学奥赛一本通-编程启蒙】3451【例82.1】不吉利日期
/*
1.13编程基础之综合应用_02不吉利日期01
http://noi.openjudge.cn/ch0113/02/
https://blog.csdn.net/ljf_study/article/details/76409549
*/
#include <stdio.h>
#include <iostream>
#include <stack>
#include <string.h>
#include <queue>
#include <cmath>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <string>
using namespace std;
typedef long long LL;
#define MAX 1001
int a[MAX][MAX];
int b[MAX][MAX];
int res[MAX][MAX];
int n, m;
int day[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int sumDay(int month)
{
int sumday = 0;
for(int i = 1; i < month; i++){
sumday += day[i];
}
sumday += 13;
return sumday;
}
int main() {
//freopen("in.txt", "r", stdin);
//freopen("out.txt", "w", stdout);
int n;
cin >> n;
for(int i = 1; i <= 12; i++){
if(((sumDay(i) - 1) % 7 + n) % 7 == 5){
cout << i << endl;
}
}
return 0;
}
/*
1.13编程基础之综合应用_02不吉利日期03
http://noi.openjudge.cn/ch0113/02/
https://blog.csdn.net/ljf_study/article/details/76409549
https://blog.csdn.net/tigerisland45/article/details/69791524
https://blog.csdn.net/Gnipuohz/article/details/8300563
*/
#include<stdio.h>
int main()
{
int day[13]={0,12,31,28,31,30,31,30,31,31,30,31,30};
int w;
int i;
scanf("%d",&w);
for(i=1;i<=12;i++)
{w=(w+day[i])%7;
if(w==5) printf("%d\n",i);
}
return 0;
}
#include<bits/stdc++.h>
using namespace std;
int w,d;
int main()
{
cin>>w;
for(int i=1;i<=12;i++)
{
if( i==1 || i==3 || i==5 || i==7 || i==8 || i==10 || i==12 )
{
d=31;
}
else
{
if( i==2 )
{
d=28;
}
else
{
d=30;
}
}
for(int j=1;j<=d;j++)
{
if( w%7==5 && j==13 )
{
cout<<i<<endl;
}
w++;
}
}
return 0;
}
Python相关的考试和认证
python刷题 NOI题库 python题解 洛谷、牛客网、AcWing 刷题等
python刷题 NOI题库 python题解 洛谷、牛客网、AcWing 刷题等_acwing和洛谷哪个好-CSDN博客
Python信息技术学考一本通题目讲解、python入门、python习题集整理汇总等
Python信息技术学考一本通题目讲解、python入门、python习题集整理汇总等_信息学奥赛一本通python网站-CSDN博客
python画图系列整理
NOI题库 python题解