zoukankan      html  css  js  c++  java
  • Codeforces Round #393 (Div. 2)

    题目链接:http://codeforces.com/contest/760/problem/A

    题意:给定一个2017年的月份和该月的第一天的星期,问该月份的日历表中需要多少列。行有7列表示星期一~日。
    思路:水题。

    import java.io.PrintWriter;
    import java.util.*;
    
    public class Main {
        public static final int MAXN=100+5;
        public static int v[]= {31,28,31,30,31,30,31,31,30,31,30,31};
        public static void main(String[] args) {
            Scanner cin = new Scanner(System.in);
            PrintWriter out = new PrintWriter(System.out);
            int m=cin.nextInt(),d=cin.nextInt();
            int cnt=v[m-1],ans=0;
            ans=(1+((cnt-(7-d+1))/7)+((cnt-(7-d+1))%7==0?0:1));
            out.println(ans);
            cin.close();
            out.flush();
        }
    }
  • 相关阅读:
    git 文件回滚
    常用函数
    触发器
    UPDATE
    DELETE
    INSERT
    完整性与约束
    流程控制
    SET ANSI_NULL ON 和 SET QUOTED_IDENTIFIFR ON
    SELECT 与 SET给标量赋值
  • 原文地址:https://www.cnblogs.com/kirito520/p/6420247.html
Copyright © 2011-2022 走看看