760A - Petr and a calendar - CodeForces Solution


implementation math *800

Please click on ads to support us..

Python Code:

n,d=map(int,input().split())
o=0
if n in [1,3,5,7,8,10,12]:
  if d==7 or d==6:
    o=6
  else:
    o=5
if n in [4,6,9,11]:
  if d==7:
    o=6
  else:
    o=5
if  n==2:
  if d==1:
    o=4
  else:
    o=5
print(o)

C++ Code:

#include <bits/stdc++.h>
using namespace std;
int movecalc(int big, int small)
{
    int moves = 0;
    int a = small;
    int b = big;
    while (true)
    {
        if (((1.00) * b) / a <= 2.00)
        {
            return moves;
        }
        else
        {
            a = 2 * a;
            ++moves;
        }
    }
}
int main()
{
    int n ;
    cin >> n ;
    int wd ;
    cin >> wd ;
    if(n == 1 or n== 3 or n == 5 or n == 7 or n == 8 or n == 10 or n == 12){
        if(wd+2 > 7){
            cout << "6" <<endl;
        }
        else{
            cout << "5" <<endl;
        }
    }
    else if(n == 4 or n == 6 or n == 9 or n == 11){
        if(wd+1 > 7){
            cout << "6" <<endl;
        }
        else{
            cout << "5" <<endl;
        }
    }else{
        if(wd == 1){
            cout << "4" <<endl;
        }
        else{
            cout << "5" <<endl;
        }
    }
    return 0;
}


Comments

Submit
0 Comments
More Questions

60. Permutation Sequence
42. Trapping Rain Water
32. Longest Valid Parentheses
Cutting a material
Bubble Sort
Number of triangles
AND path in a binary tree
Factorial equations
Removal of vertices
Happy segments
Cyclic shifts
Zoos
Build a graph
Almost correct bracket sequence
Count of integers
Differences of the permutations
Doctor's Secret
Back to School
I am Easy
Teddy and Tweety
Partitioning binary strings
Special sets
Smallest chosen word
Going to office
Color the boxes
Missing numbers
Maximum sum
13 Reasons Why
Friend's Relationship
Health of a person