0
0

More than 1 year has passed since last update.

ABC225 C問題(python)

Last updated at Posted at 2022-02-08

C - Calendar Validator

*留意事項
取り出した短形領域Bの各行は、
1,2,3,4,5,6,0 mod(7)の順番から
抜き出した並びになっている必要がある。

b=[]
l=True
k=0
n=0
s=0
N,M=map(int,input().split())
for _ in range(N):
    b=list(map(int,input().split()))
    if ((k!=0) and (b[0]!=(n+7))):
        l=False
        break

    n=b[0]
    for i in range(M-1):
        if s==1:
            l=False
            break
        if  (b[i+1]-b[i])!=1:
            l=False
            break
        if b[i]%7==0:
            s=s+1
    k=k+1
if l:
    print("Yes")
else:
    print("No")
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0