1409A - Yet Another Two Integers Problem
t = int(input())
while t > 0:
a,b = map(int,input().split())
print((abs(a - b) + 9) // 10)
t -= 1
# | User | Rating |
---|---|---|
1 | tourist | 3690 |
2 | jiangly | 3647 |
3 | Benq | 3581 |
4 | orzdevinwang | 3570 |
5 | Geothermal | 3569 |
5 | cnnfls_csy | 3569 |
7 | Radewoosh | 3509 |
8 | ecnerwala | 3486 |
9 | jqdai0815 | 3474 |
10 | gyh20 | 3447 |
# | User | Contrib. |
---|---|---|
1 | maomao90 | 174 |
2 | awoo | 165 |
3 | adamant | 161 |
4 | TheScrasse | 160 |
5 | nor | 158 |
6 | maroonrk | 156 |
7 | -is-this-fft- | 152 |
8 | orz | 146 |
8 | SecondThread | 146 |
10 | pajenegod | 145 |
1409A - Yet Another Two Integers Problem
t = int(input())
while t > 0:
a,b = map(int,input().split())
print((abs(a - b) + 9) // 10)
t -= 1
Python Solution
t = int(input())
while t > 0:
n = int(input())
s = input()
if s[n-1] == '0':
s.replace(s[n-1],'')
odd,even = False, False
i = 1
for i in range(n+1):
if i % 2 == 1:
odd |= (int(s[i - 1]) % 2 == 1)
else:
even |= (int(s[i - 1]) % 2 == 0)
if n % 2 == 1:
if (odd):
print(1)
else:
print(2)
else:
if (even):
print(2)
else:
print(1)
t -= 1
Name |
---|