output_description
stringlengths
15
956
submission_id
stringlengths
10
10
status
stringclasses
3 values
problem_id
stringlengths
6
6
input_description
stringlengths
9
2.55k
attempt
stringlengths
1
13.7k
problem_description
stringlengths
7
5.24k
samples
stringlengths
2
2.72k
If N_1, N_2, N_3 and N_4 can be arranged into the sequence of digits "1974", print `YES`; if they cannot, print `NO`. * * *
s426218092
Accepted
p03149
Input is given from Standard Input in the following format: N_1 N_2 N_3 N_4
# KEYENCE Programming Contest 2019 / キーエンス プログラミング コンテスト 2019: A – Beginning n = sorted(map(int, input().split())) print("YES" if n == [1, 4, 7, 9] else "NO")
Statement You are given four digits N_1, N_2, N_3 and N_4. Determine if these can be arranged into the sequence of digits "1974".
[{"input": "1 7 9 4", "output": "YES\n \n\nWe can get 1974 by swapping N_2 and N_3.\n\n* * *"}, {"input": "1 9 7 4", "output": "YES\n \n\nWe already have 1974 before doing anything.\n\n* * *"}, {"input": "1 2 9 1", "output": "NO\n \n\n* * *"}, {"input": "4 9 0 8", "output": "NO"}]
If N_1, N_2, N_3 and N_4 can be arranged into the sequence of digits "1974", print `YES`; if they cannot, print `NO`. * * *
s034135945
Runtime Error
p03149
Input is given from Standard Input in the following format: N_1 N_2 N_3 N_4
import sys N, M = map(int, input().split()) A = [int(a) for a in input().split()] B = [int(b) for b in input().split()] A.sort(reverse=True) B.sort(reverse=True) if len(set(A))!=len(A) or len(set(B))!=len(B): print(0) sys.exit() ans = 1 rows, columna = 0,0 mod = 10**9+7 for x in range(N*M, 0, -1): if x in A and x in B: rows += 1 columna += 1 elif x in A and not x in B: rows += 1 ans = ans * (columna) elif x in B and not x in A: columna += 1 ans = ans *(rows) else: ans = ans * (rows * columna -(N*M-x ans %= mod print(ans%(10**9+7))
Statement You are given four digits N_1, N_2, N_3 and N_4. Determine if these can be arranged into the sequence of digits "1974".
[{"input": "1 7 9 4", "output": "YES\n \n\nWe can get 1974 by swapping N_2 and N_3.\n\n* * *"}, {"input": "1 9 7 4", "output": "YES\n \n\nWe already have 1974 before doing anything.\n\n* * *"}, {"input": "1 2 9 1", "output": "NO\n \n\n* * *"}, {"input": "4 9 0 8", "output": "NO"}]
If N_1, N_2, N_3 and N_4 can be arranged into the sequence of digits "1974", print `YES`; if they cannot, print `NO`. * * *
s270027233
Runtime Error
p03149
Input is given from Standard Input in the following format: N_1 N_2 N_3 N_4
f = [] f = input().split() if '1' in f: if '9' in f: if '7' in f: if '4' in f: print("YES") else: print("NO") else: print("NO") else: print("NO") else: print("NO")
Statement You are given four digits N_1, N_2, N_3 and N_4. Determine if these can be arranged into the sequence of digits "1974".
[{"input": "1 7 9 4", "output": "YES\n \n\nWe can get 1974 by swapping N_2 and N_3.\n\n* * *"}, {"input": "1 9 7 4", "output": "YES\n \n\nWe already have 1974 before doing anything.\n\n* * *"}, {"input": "1 2 9 1", "output": "NO\n \n\n* * *"}, {"input": "4 9 0 8", "output": "NO"}]
If N_1, N_2, N_3 and N_4 can be arranged into the sequence of digits "1974", print `YES`; if they cannot, print `NO`. * * *
s762896315
Runtime Error
p03149
Input is given from Standard Input in the following format: N_1 N_2 N_3 N_4
import re a = input() if re.match('(.*)keyence', a): print("YES") else: if re.match('k(.*)eyence', a) print("YES") else: if re.match('ke(.*)yence', a) print("YES") else: print("NO")
Statement You are given four digits N_1, N_2, N_3 and N_4. Determine if these can be arranged into the sequence of digits "1974".
[{"input": "1 7 9 4", "output": "YES\n \n\nWe can get 1974 by swapping N_2 and N_3.\n\n* * *"}, {"input": "1 9 7 4", "output": "YES\n \n\nWe already have 1974 before doing anything.\n\n* * *"}, {"input": "1 2 9 1", "output": "NO\n \n\n* * *"}, {"input": "4 9 0 8", "output": "NO"}]
If N_1, N_2, N_3 and N_4 can be arranged into the sequence of digits "1974", print `YES`; if they cannot, print `NO`. * * *
s889324639
Runtime Error
p03149
Input is given from Standard Input in the following format: N_1 N_2 N_3 N_4
a = [False,False,False,False] for x in input().split(): if(x == 1): a[0] =True else if(x == 9): a[1] = True else if(x == 4): a[2] = True else if(x == 7): a[3] = True all = True for x in a: all &= x print('YES' if all else 'NO')
Statement You are given four digits N_1, N_2, N_3 and N_4. Determine if these can be arranged into the sequence of digits "1974".
[{"input": "1 7 9 4", "output": "YES\n \n\nWe can get 1974 by swapping N_2 and N_3.\n\n* * *"}, {"input": "1 9 7 4", "output": "YES\n \n\nWe already have 1974 before doing anything.\n\n* * *"}, {"input": "1 2 9 1", "output": "NO\n \n\n* * *"}, {"input": "4 9 0 8", "output": "NO"}]
If N_1, N_2, N_3 and N_4 can be arranged into the sequence of digits "1974", print `YES`; if they cannot, print `NO`. * * *
s594672545
Runtime Error
p03149
Input is given from Standard Input in the following format: N_1 N_2 N_3 N_4
import operator def solve(A, B): diff = list(map(operator.sub, A, B)) shortage = list(filter(lambda d: d < 0, diff)) remainder = list(filter(lambda d: d > 0, diff)) remainder.sort(reverse=True) short_sum = sum(shortage) if short_sum == 0: return 0 counter = len(shortage) for r in remainder: short_sum += r counter += 1 if short_sum >= 0: return counter return -1 N = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) print(solve(A, B))
Statement You are given four digits N_1, N_2, N_3 and N_4. Determine if these can be arranged into the sequence of digits "1974".
[{"input": "1 7 9 4", "output": "YES\n \n\nWe can get 1974 by swapping N_2 and N_3.\n\n* * *"}, {"input": "1 9 7 4", "output": "YES\n \n\nWe already have 1974 before doing anything.\n\n* * *"}, {"input": "1 2 9 1", "output": "NO\n \n\n* * *"}, {"input": "4 9 0 8", "output": "NO"}]
If N_1, N_2, N_3 and N_4 can be arranged into the sequence of digits "1974", print `YES`; if they cannot, print `NO`. * * *
s771666600
Runtime Error
p03149
Input is given from Standard Input in the following format: N_1 N_2 N_3 N_4
import sys """テンプレ""" # 高速 input = sys.stdin.readline # 1行を空白でリストにする(int) def intline(): return list(map(int, input().split())) # 上のstrヴァージョン def strline(): return list(map(str, input().split())) # 1列に並んだ数 def intlines(n): return [int(input() for _ in range(n))] # 上の文字列ヴァージョン def lines(n): return [input() for _ in range(n)] """ここからメインコード""" k = intline().sort() if k = [1, 4, 7, 9]:print("YES") else:print("NO")
Statement You are given four digits N_1, N_2, N_3 and N_4. Determine if these can be arranged into the sequence of digits "1974".
[{"input": "1 7 9 4", "output": "YES\n \n\nWe can get 1974 by swapping N_2 and N_3.\n\n* * *"}, {"input": "1 9 7 4", "output": "YES\n \n\nWe already have 1974 before doing anything.\n\n* * *"}, {"input": "1 2 9 1", "output": "NO\n \n\n* * *"}, {"input": "4 9 0 8", "output": "NO"}]
If N_1, N_2, N_3 and N_4 can be arranged into the sequence of digits "1974", print `YES`; if they cannot, print `NO`. * * *
s851669175
Runtime Error
p03149
Input is given from Standard Input in the following format: N_1 N_2 N_3 N_4
def data_input(): a,b,c,d = input().split(' ') a = int(a) b = int(b) c = int(c) d = int(d) return (a,b,c,d) def answer(): a,b,c,d = data_input() s = '1974' return if a in s and b in s and c in s and d in s
Statement You are given four digits N_1, N_2, N_3 and N_4. Determine if these can be arranged into the sequence of digits "1974".
[{"input": "1 7 9 4", "output": "YES\n \n\nWe can get 1974 by swapping N_2 and N_3.\n\n* * *"}, {"input": "1 9 7 4", "output": "YES\n \n\nWe already have 1974 before doing anything.\n\n* * *"}, {"input": "1 2 9 1", "output": "NO\n \n\n* * *"}, {"input": "4 9 0 8", "output": "NO"}]
If N_1, N_2, N_3 and N_4 can be arranged into the sequence of digits "1974", print `YES`; if they cannot, print `NO`. * * *
s089514776
Runtime Error
p03149
Input is given from Standard Input in the following format: N_1 N_2 N_3 N_4
#include <iostream> #include <vector> #include <algorithm> #include <utility> #include <string> #include <queue> #include <stack> using namespace std; typedef long long int ll; typedef pair<int, int> Pii; const ll mod = 1000000007; int main() { cin.tie(0); ios::sync_with_stdio(false); vector<int> n(4); for (auto &x: n) cin >> x; sort(n.begin(), n.end()); if (n[0] == 1 && n[1] == 4 && n[2] == 7 && n[3] == 9) { cout << "YES" << endl; } else { cout << "NO" << endl; } return 0; }
Statement You are given four digits N_1, N_2, N_3 and N_4. Determine if these can be arranged into the sequence of digits "1974".
[{"input": "1 7 9 4", "output": "YES\n \n\nWe can get 1974 by swapping N_2 and N_3.\n\n* * *"}, {"input": "1 9 7 4", "output": "YES\n \n\nWe already have 1974 before doing anything.\n\n* * *"}, {"input": "1 2 9 1", "output": "NO\n \n\n* * *"}, {"input": "4 9 0 8", "output": "NO"}]
If N_1, N_2, N_3 and N_4 can be arranged into the sequence of digits "1974", print `YES`; if they cannot, print `NO`. * * *
s187019921
Runtime Error
p03149
Input is given from Standard Input in the following format: N_1 N_2 N_3 N_4
import re a = input() if re.match('(.*)keyence', a): print("YES") return if re.match('k(.*)eyence', a) print("YES") return if re.match('ke(.*)yence', a) print("YES") return if re.match('key(.*)ence', a) print("YES") return if re.match('keye(.*)nce', a) print("YES") return if re.match('keyen(.*)ce', a) print("YES") return if re.match('keyenc(.*)e', a) print("YES") return if re.match('keyence(.*)', a) print("YES") return print("NO")
Statement You are given four digits N_1, N_2, N_3 and N_4. Determine if these can be arranged into the sequence of digits "1974".
[{"input": "1 7 9 4", "output": "YES\n \n\nWe can get 1974 by swapping N_2 and N_3.\n\n* * *"}, {"input": "1 9 7 4", "output": "YES\n \n\nWe already have 1974 before doing anything.\n\n* * *"}, {"input": "1 2 9 1", "output": "NO\n \n\n* * *"}, {"input": "4 9 0 8", "output": "NO"}]
If N_1, N_2, N_3 and N_4 can be arranged into the sequence of digits "1974", print `YES`; if they cannot, print `NO`. * * *
s793897481
Accepted
p03149
Input is given from Standard Input in the following format: N_1 N_2 N_3 N_4
N1, N2, N3, N4 = sorted(map(int, input().split())) print("YES" if N1 == 1 and N2 == 4 and N3 == 7 and N4 == 9 else "NO")
Statement You are given four digits N_1, N_2, N_3 and N_4. Determine if these can be arranged into the sequence of digits "1974".
[{"input": "1 7 9 4", "output": "YES\n \n\nWe can get 1974 by swapping N_2 and N_3.\n\n* * *"}, {"input": "1 9 7 4", "output": "YES\n \n\nWe already have 1974 before doing anything.\n\n* * *"}, {"input": "1 2 9 1", "output": "NO\n \n\n* * *"}, {"input": "4 9 0 8", "output": "NO"}]
If N_1, N_2, N_3 and N_4 can be arranged into the sequence of digits "1974", print `YES`; if they cannot, print `NO`. * * *
s202313824
Runtime Error
p03149
Input is given from Standard Input in the following format: N_1 N_2 N_3 N_4
A,B,C,D=(int(i) for i in input().split()) if {A,B,C,D}=={1,9,7,4}: print("Yes") elif: print("No")
Statement You are given four digits N_1, N_2, N_3 and N_4. Determine if these can be arranged into the sequence of digits "1974".
[{"input": "1 7 9 4", "output": "YES\n \n\nWe can get 1974 by swapping N_2 and N_3.\n\n* * *"}, {"input": "1 9 7 4", "output": "YES\n \n\nWe already have 1974 before doing anything.\n\n* * *"}, {"input": "1 2 9 1", "output": "NO\n \n\n* * *"}, {"input": "4 9 0 8", "output": "NO"}]
If N_1, N_2, N_3 and N_4 can be arranged into the sequence of digits "1974", print `YES`; if they cannot, print `NO`. * * *
s725946627
Runtime Error
p03149
Input is given from Standard Input in the following format: N_1 N_2 N_3 N_4
get=input() flg=0 for a in get.split(): if int(a) in[1,9,7,4] flg+=1 if flg==4: print("YES") else: print("NO")
Statement You are given four digits N_1, N_2, N_3 and N_4. Determine if these can be arranged into the sequence of digits "1974".
[{"input": "1 7 9 4", "output": "YES\n \n\nWe can get 1974 by swapping N_2 and N_3.\n\n* * *"}, {"input": "1 9 7 4", "output": "YES\n \n\nWe already have 1974 before doing anything.\n\n* * *"}, {"input": "1 2 9 1", "output": "NO\n \n\n* * *"}, {"input": "4 9 0 8", "output": "NO"}]
If N_1, N_2, N_3 and N_4 can be arranged into the sequence of digits "1974", print `YES`; if they cannot, print `NO`. * * *
s928766552
Runtime Error
p03149
Input is given from Standard Input in the following format: N_1 N_2 N_3 N_4
n = int(input.()split()) if 1 in n and 9 in n and 7 in n and 4 in n: print("YES") else: print("NO")
Statement You are given four digits N_1, N_2, N_3 and N_4. Determine if these can be arranged into the sequence of digits "1974".
[{"input": "1 7 9 4", "output": "YES\n \n\nWe can get 1974 by swapping N_2 and N_3.\n\n* * *"}, {"input": "1 9 7 4", "output": "YES\n \n\nWe already have 1974 before doing anything.\n\n* * *"}, {"input": "1 2 9 1", "output": "NO\n \n\n* * *"}, {"input": "4 9 0 8", "output": "NO"}]
If N_1, N_2, N_3 and N_4 can be arranged into the sequence of digits "1974", print `YES`; if they cannot, print `NO`. * * *
s984559477
Runtime Error
p03149
Input is given from Standard Input in the following format: N_1 N_2 N_3 N_4
if set(input().split())==set("1974"): print("Yes") else: print("No")
Statement You are given four digits N_1, N_2, N_3 and N_4. Determine if these can be arranged into the sequence of digits "1974".
[{"input": "1 7 9 4", "output": "YES\n \n\nWe can get 1974 by swapping N_2 and N_3.\n\n* * *"}, {"input": "1 9 7 4", "output": "YES\n \n\nWe already have 1974 before doing anything.\n\n* * *"}, {"input": "1 2 9 1", "output": "NO\n \n\n* * *"}, {"input": "4 9 0 8", "output": "NO"}]
If N_1, N_2, N_3 and N_4 can be arranged into the sequence of digits "1974", print `YES`; if they cannot, print `NO`. * * *
s699008825
Runtime Error
p03149
Input is given from Standard Input in the following format: N_1 N_2 N_3 N_4
n1, n2, n3, n4=map(int,input().split()) n=[] n.append(n1, n2, n3, n4) if 1, ,7 ,9, 4 in n: print('YES') else: print('NO')
Statement You are given four digits N_1, N_2, N_3 and N_4. Determine if these can be arranged into the sequence of digits "1974".
[{"input": "1 7 9 4", "output": "YES\n \n\nWe can get 1974 by swapping N_2 and N_3.\n\n* * *"}, {"input": "1 9 7 4", "output": "YES\n \n\nWe already have 1974 before doing anything.\n\n* * *"}, {"input": "1 2 9 1", "output": "NO\n \n\n* * *"}, {"input": "4 9 0 8", "output": "NO"}]
Print the maximum number of operations that Snuke can perform. * * *
s488670416
Accepted
p03325
Input is given from Standard Input in the following format: N a_1 a_2 a_3 ... a_N
############################################################################### from sys import stdout from bisect import bisect_left as binl from copy import copy, deepcopy from collections import defaultdict mod = 1 def intin(): input_tuple = input().split() if len(input_tuple) <= 1: return int(input_tuple[0]) return tuple(map(int, input_tuple)) def intina(): return [int(i) for i in input().split()] def intinl(count): return [intin() for _ in range(count)] def modadd(x, y): global mod return (x + y) % mod def modmlt(x, y): global mod return (x * y) % mod def lcm(x, y): while y != 0: z = x % y x = y y = z return x def combination(x, y): assert x >= y if y > x // 2: y = x - y ret = 1 for i in range(0, y): j = x - i i = i + 1 ret = ret * j ret = ret // i return ret def get_divisors(x): retlist = [] for i in range(1, int(x**0.5) + 3): if x % i == 0: retlist.append(i) retlist.append(x // i) return retlist def get_factors(x): retlist = [] for i in range(2, int(x**0.5) + 3): while x % i == 0: retlist.append(i) x = x // i retlist.append(x) return retlist def make_linklist(xylist): linklist = {} for a, b in xylist: linklist.setdefault(a, []) linklist.setdefault(b, []) linklist[a].append(b) linklist[b].append(a) return linklist def calc_longest_distance(linklist, v=1): distance_list = {} distance_count = 0 distance = 0 vlist_previous = [] vlist = [v] nodecount = len(linklist) while distance_count < nodecount: vlist_next = [] for v in vlist: distance_list[v] = distance distance_count += 1 vlist_next.extend(linklist[v]) distance += 1 vlist_to_del = vlist_previous vlist_previous = vlist vlist = list(set(vlist_next) - set(vlist_to_del)) max_distance = -1 max_v = None for v, distance in distance_list.items(): if distance > max_distance: max_distance = distance max_v = v return (max_distance, max_v) def calc_tree_diameter(linklist, v=1): _, u = calc_longest_distance(linklist, v) distance, _ = calc_longest_distance(linklist, u) return distance ############################################################################### def main(): n = intin() alist = intina() ans = 0 for a in alist: while a & 1 == 0: a >>= 1 ans += 1 print(ans) if __name__ == "__main__": main()
Statement As AtCoder Beginner Contest 100 is taking place, the office of AtCoder, Inc. is decorated with a sequence of length N, a = {a_1, a_2, a_3, ..., a_N}. Snuke, an employee, would like to play with this sequence. Specifically, he would like to repeat the following operation as many times as possible: For every i satisfying 1 \leq i \leq N, perform one of the following: "divide a_i by 2" and "multiply a_i by 3". Here, choosing "multiply a_i by 3" for every i is not allowed, and the value of a_i after the operation must be an integer. At most how many operations can be performed?
[{"input": "3\n 5 2 4", "output": "3\n \n\nThe sequence is initially {5, 2, 4}. Three operations can be performed as\nfollows:\n\n * First, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {15, 6, 2}.\n * Next, multiply a_1 by 3, divide a_2 by 2 and multiply a_3 by 3. The sequence is now {45, 3, 6}.\n * Finally, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {135, 9, 3}.\n\n* * *"}, {"input": "4\n 631 577 243 199", "output": "0\n \n\nNo operation can be performed since all the elements are odd. Thus, the answer\nis 0.\n\n* * *"}, {"input": "10\n 2184 2126 1721 1800 1024 2528 3360 1945 1280 1776", "output": "39"}]
Print the maximum number of operations that Snuke can perform. * * *
s837772907
Accepted
p03325
Input is given from Standard Input in the following format: N a_1 a_2 a_3 ... a_N
#!/usr/bin/env python3 print(sum(bin(i)[::-1].find("1") for i in [*map(int, open(0).read().split())][1:]))
Statement As AtCoder Beginner Contest 100 is taking place, the office of AtCoder, Inc. is decorated with a sequence of length N, a = {a_1, a_2, a_3, ..., a_N}. Snuke, an employee, would like to play with this sequence. Specifically, he would like to repeat the following operation as many times as possible: For every i satisfying 1 \leq i \leq N, perform one of the following: "divide a_i by 2" and "multiply a_i by 3". Here, choosing "multiply a_i by 3" for every i is not allowed, and the value of a_i after the operation must be an integer. At most how many operations can be performed?
[{"input": "3\n 5 2 4", "output": "3\n \n\nThe sequence is initially {5, 2, 4}. Three operations can be performed as\nfollows:\n\n * First, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {15, 6, 2}.\n * Next, multiply a_1 by 3, divide a_2 by 2 and multiply a_3 by 3. The sequence is now {45, 3, 6}.\n * Finally, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {135, 9, 3}.\n\n* * *"}, {"input": "4\n 631 577 243 199", "output": "0\n \n\nNo operation can be performed since all the elements are odd. Thus, the answer\nis 0.\n\n* * *"}, {"input": "10\n 2184 2126 1721 1800 1024 2528 3360 1945 1280 1776", "output": "39"}]
Print the maximum number of operations that Snuke can perform. * * *
s733102632
Runtime Error
p03325
Input is given from Standard Input in the following format: N a_1 a_2 a_3 ... a_N
i = input i() i(sum([len(bin(a & -a)) - 3 for a in map(int, i().split())]))
Statement As AtCoder Beginner Contest 100 is taking place, the office of AtCoder, Inc. is decorated with a sequence of length N, a = {a_1, a_2, a_3, ..., a_N}. Snuke, an employee, would like to play with this sequence. Specifically, he would like to repeat the following operation as many times as possible: For every i satisfying 1 \leq i \leq N, perform one of the following: "divide a_i by 2" and "multiply a_i by 3". Here, choosing "multiply a_i by 3" for every i is not allowed, and the value of a_i after the operation must be an integer. At most how many operations can be performed?
[{"input": "3\n 5 2 4", "output": "3\n \n\nThe sequence is initially {5, 2, 4}. Three operations can be performed as\nfollows:\n\n * First, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {15, 6, 2}.\n * Next, multiply a_1 by 3, divide a_2 by 2 and multiply a_3 by 3. The sequence is now {45, 3, 6}.\n * Finally, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {135, 9, 3}.\n\n* * *"}, {"input": "4\n 631 577 243 199", "output": "0\n \n\nNo operation can be performed since all the elements are odd. Thus, the answer\nis 0.\n\n* * *"}, {"input": "10\n 2184 2126 1721 1800 1024 2528 3360 1945 1280 1776", "output": "39"}]
Print the maximum number of operations that Snuke can perform. * * *
s958753749
Runtime Error
p03325
Input is given from Standard Input in the following format: N a_1 a_2 a_3 ... a_N
n=int(input()) a=list(map(int,input().split())) cnt=0 for i in range(n): while a[i]%2=0: a[i]=a[i]/2 cnt+=1 print(cnt)
Statement As AtCoder Beginner Contest 100 is taking place, the office of AtCoder, Inc. is decorated with a sequence of length N, a = {a_1, a_2, a_3, ..., a_N}. Snuke, an employee, would like to play with this sequence. Specifically, he would like to repeat the following operation as many times as possible: For every i satisfying 1 \leq i \leq N, perform one of the following: "divide a_i by 2" and "multiply a_i by 3". Here, choosing "multiply a_i by 3" for every i is not allowed, and the value of a_i after the operation must be an integer. At most how many operations can be performed?
[{"input": "3\n 5 2 4", "output": "3\n \n\nThe sequence is initially {5, 2, 4}. Three operations can be performed as\nfollows:\n\n * First, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {15, 6, 2}.\n * Next, multiply a_1 by 3, divide a_2 by 2 and multiply a_3 by 3. The sequence is now {45, 3, 6}.\n * Finally, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {135, 9, 3}.\n\n* * *"}, {"input": "4\n 631 577 243 199", "output": "0\n \n\nNo operation can be performed since all the elements are odd. Thus, the answer\nis 0.\n\n* * *"}, {"input": "10\n 2184 2126 1721 1800 1024 2528 3360 1945 1280 1776", "output": "39"}]
Print the maximum number of operations that Snuke can perform. * * *
s280873832
Runtime Error
p03325
Input is given from Standard Input in the following format: N a_1 a_2 a_3 ... a_N
N=int(input()) A=list(int, input().split()) counter=[] for num in range(N): counter.append(0) for num in range(N): while A[num]%2=0: A[num]=A[num]/2 counter[num]+=1 print(sum(counter))
Statement As AtCoder Beginner Contest 100 is taking place, the office of AtCoder, Inc. is decorated with a sequence of length N, a = {a_1, a_2, a_3, ..., a_N}. Snuke, an employee, would like to play with this sequence. Specifically, he would like to repeat the following operation as many times as possible: For every i satisfying 1 \leq i \leq N, perform one of the following: "divide a_i by 2" and "multiply a_i by 3". Here, choosing "multiply a_i by 3" for every i is not allowed, and the value of a_i after the operation must be an integer. At most how many operations can be performed?
[{"input": "3\n 5 2 4", "output": "3\n \n\nThe sequence is initially {5, 2, 4}. Three operations can be performed as\nfollows:\n\n * First, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {15, 6, 2}.\n * Next, multiply a_1 by 3, divide a_2 by 2 and multiply a_3 by 3. The sequence is now {45, 3, 6}.\n * Finally, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {135, 9, 3}.\n\n* * *"}, {"input": "4\n 631 577 243 199", "output": "0\n \n\nNo operation can be performed since all the elements are odd. Thus, the answer\nis 0.\n\n* * *"}, {"input": "10\n 2184 2126 1721 1800 1024 2528 3360 1945 1280 1776", "output": "39"}]
Print the maximum number of operations that Snuke can perform. * * *
s915735457
Runtime Error
p03325
Input is given from Standard Input in the following format: N a_1 a_2 a_3 ... a_N
N = int(input()) A = list(int, input().split()) counter = [] for num in range(len(A)): counter.append(0) for num in range(len(A)): while A[num] % 2 == 0: A[num] = A[num] / 2 counter[num] += 1 print(sum(counter))
Statement As AtCoder Beginner Contest 100 is taking place, the office of AtCoder, Inc. is decorated with a sequence of length N, a = {a_1, a_2, a_3, ..., a_N}. Snuke, an employee, would like to play with this sequence. Specifically, he would like to repeat the following operation as many times as possible: For every i satisfying 1 \leq i \leq N, perform one of the following: "divide a_i by 2" and "multiply a_i by 3". Here, choosing "multiply a_i by 3" for every i is not allowed, and the value of a_i after the operation must be an integer. At most how many operations can be performed?
[{"input": "3\n 5 2 4", "output": "3\n \n\nThe sequence is initially {5, 2, 4}. Three operations can be performed as\nfollows:\n\n * First, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {15, 6, 2}.\n * Next, multiply a_1 by 3, divide a_2 by 2 and multiply a_3 by 3. The sequence is now {45, 3, 6}.\n * Finally, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {135, 9, 3}.\n\n* * *"}, {"input": "4\n 631 577 243 199", "output": "0\n \n\nNo operation can be performed since all the elements are odd. Thus, the answer\nis 0.\n\n* * *"}, {"input": "10\n 2184 2126 1721 1800 1024 2528 3360 1945 1280 1776", "output": "39"}]
Print the maximum number of operations that Snuke can perform. * * *
s857246042
Accepted
p03325
Input is given from Standard Input in the following format: N a_1 a_2 a_3 ... a_N
n = int(input()) alist = [int(x) for x in input().split()] twolist = [ 536870912, 268435456, 134217728, 67108864, 33554432, 16777216, 8388608, 4194304, 2097152, 1048576, 524288, 262144, 131072, 65536, 32768, 16384, 8192, 4096, 2048, 1024, 512, 256, 128, 64, 32, 16, 8, 4, 2, ] count = 0 for x in alist: for i, num in enumerate(twolist): if x % num == 0: count += 29 - i break print(count)
Statement As AtCoder Beginner Contest 100 is taking place, the office of AtCoder, Inc. is decorated with a sequence of length N, a = {a_1, a_2, a_3, ..., a_N}. Snuke, an employee, would like to play with this sequence. Specifically, he would like to repeat the following operation as many times as possible: For every i satisfying 1 \leq i \leq N, perform one of the following: "divide a_i by 2" and "multiply a_i by 3". Here, choosing "multiply a_i by 3" for every i is not allowed, and the value of a_i after the operation must be an integer. At most how many operations can be performed?
[{"input": "3\n 5 2 4", "output": "3\n \n\nThe sequence is initially {5, 2, 4}. Three operations can be performed as\nfollows:\n\n * First, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {15, 6, 2}.\n * Next, multiply a_1 by 3, divide a_2 by 2 and multiply a_3 by 3. The sequence is now {45, 3, 6}.\n * Finally, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {135, 9, 3}.\n\n* * *"}, {"input": "4\n 631 577 243 199", "output": "0\n \n\nNo operation can be performed since all the elements are odd. Thus, the answer\nis 0.\n\n* * *"}, {"input": "10\n 2184 2126 1721 1800 1024 2528 3360 1945 1280 1776", "output": "39"}]
Print the maximum number of operations that Snuke can perform. * * *
s094472167
Accepted
p03325
Input is given from Standard Input in the following format: N a_1 a_2 a_3 ... a_N
from math import log2, ceil def solve(n, A): def count_div2(m): if m % 2 == 1: return 0 l, r = 0, ceil(log2(m)) + 1 while r - l > 1: p = (r + l) // 2 if m % (2**p) == 0: l = p else: r = p return l return sum(count_div2(a) for a in A) _n = int(input()) _A = map(int, input().split()) print(solve(_n, _A))
Statement As AtCoder Beginner Contest 100 is taking place, the office of AtCoder, Inc. is decorated with a sequence of length N, a = {a_1, a_2, a_3, ..., a_N}. Snuke, an employee, would like to play with this sequence. Specifically, he would like to repeat the following operation as many times as possible: For every i satisfying 1 \leq i \leq N, perform one of the following: "divide a_i by 2" and "multiply a_i by 3". Here, choosing "multiply a_i by 3" for every i is not allowed, and the value of a_i after the operation must be an integer. At most how many operations can be performed?
[{"input": "3\n 5 2 4", "output": "3\n \n\nThe sequence is initially {5, 2, 4}. Three operations can be performed as\nfollows:\n\n * First, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {15, 6, 2}.\n * Next, multiply a_1 by 3, divide a_2 by 2 and multiply a_3 by 3. The sequence is now {45, 3, 6}.\n * Finally, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {135, 9, 3}.\n\n* * *"}, {"input": "4\n 631 577 243 199", "output": "0\n \n\nNo operation can be performed since all the elements are odd. Thus, the answer\nis 0.\n\n* * *"}, {"input": "10\n 2184 2126 1721 1800 1024 2528 3360 1945 1280 1776", "output": "39"}]
Print the maximum number of operations that Snuke can perform. * * *
s942149990
Runtime Error
p03325
Input is given from Standard Input in the following format: N a_1 a_2 a_3 ... a_N
N = int(input()) a_li = list(map(int,input().split())) count = 0 for i in a_li: while i % 2 == 0: cnt += 1 i //= 2 if i % 2 != 0: break print(count)
Statement As AtCoder Beginner Contest 100 is taking place, the office of AtCoder, Inc. is decorated with a sequence of length N, a = {a_1, a_2, a_3, ..., a_N}. Snuke, an employee, would like to play with this sequence. Specifically, he would like to repeat the following operation as many times as possible: For every i satisfying 1 \leq i \leq N, perform one of the following: "divide a_i by 2" and "multiply a_i by 3". Here, choosing "multiply a_i by 3" for every i is not allowed, and the value of a_i after the operation must be an integer. At most how many operations can be performed?
[{"input": "3\n 5 2 4", "output": "3\n \n\nThe sequence is initially {5, 2, 4}. Three operations can be performed as\nfollows:\n\n * First, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {15, 6, 2}.\n * Next, multiply a_1 by 3, divide a_2 by 2 and multiply a_3 by 3. The sequence is now {45, 3, 6}.\n * Finally, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {135, 9, 3}.\n\n* * *"}, {"input": "4\n 631 577 243 199", "output": "0\n \n\nNo operation can be performed since all the elements are odd. Thus, the answer\nis 0.\n\n* * *"}, {"input": "10\n 2184 2126 1721 1800 1024 2528 3360 1945 1280 1776", "output": "39"}]
Print the maximum number of operations that Snuke can perform. * * *
s265836138
Runtime Error
p03325
Input is given from Standard Input in the following format: N a_1 a_2 a_3 ... a_N
import collections import numpy as np def prime_factorize(n): a = [] if n%2 ==1: a=0 while n % 2 == 0: a.append(2) n //= 2 return a N =int(input()) a = [int(i) for i in input().split()] ans_array = np.zeros(N) for i in range(N): dummy = prime_factorize(a[i]) ans_array[i] = dummy ans = int(sum(ans_array)) print(ans)
Statement As AtCoder Beginner Contest 100 is taking place, the office of AtCoder, Inc. is decorated with a sequence of length N, a = {a_1, a_2, a_3, ..., a_N}. Snuke, an employee, would like to play with this sequence. Specifically, he would like to repeat the following operation as many times as possible: For every i satisfying 1 \leq i \leq N, perform one of the following: "divide a_i by 2" and "multiply a_i by 3". Here, choosing "multiply a_i by 3" for every i is not allowed, and the value of a_i after the operation must be an integer. At most how many operations can be performed?
[{"input": "3\n 5 2 4", "output": "3\n \n\nThe sequence is initially {5, 2, 4}. Three operations can be performed as\nfollows:\n\n * First, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {15, 6, 2}.\n * Next, multiply a_1 by 3, divide a_2 by 2 and multiply a_3 by 3. The sequence is now {45, 3, 6}.\n * Finally, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {135, 9, 3}.\n\n* * *"}, {"input": "4\n 631 577 243 199", "output": "0\n \n\nNo operation can be performed since all the elements are odd. Thus, the answer\nis 0.\n\n* * *"}, {"input": "10\n 2184 2126 1721 1800 1024 2528 3360 1945 1280 1776", "output": "39"}]
Print the maximum number of operations that Snuke can perform. * * *
s888377380
Runtime Error
p03325
Input is given from Standard Input in the following format: N a_1 a_2 a_3 ... a_N
N = int(input()) a = list(map(int, input().split())) count = 0 for i in range(N): for n in a: if n % 2 == 0: count += 1 n /= 2 print(count)
Statement As AtCoder Beginner Contest 100 is taking place, the office of AtCoder, Inc. is decorated with a sequence of length N, a = {a_1, a_2, a_3, ..., a_N}. Snuke, an employee, would like to play with this sequence. Specifically, he would like to repeat the following operation as many times as possible: For every i satisfying 1 \leq i \leq N, perform one of the following: "divide a_i by 2" and "multiply a_i by 3". Here, choosing "multiply a_i by 3" for every i is not allowed, and the value of a_i after the operation must be an integer. At most how many operations can be performed?
[{"input": "3\n 5 2 4", "output": "3\n \n\nThe sequence is initially {5, 2, 4}. Three operations can be performed as\nfollows:\n\n * First, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {15, 6, 2}.\n * Next, multiply a_1 by 3, divide a_2 by 2 and multiply a_3 by 3. The sequence is now {45, 3, 6}.\n * Finally, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {135, 9, 3}.\n\n* * *"}, {"input": "4\n 631 577 243 199", "output": "0\n \n\nNo operation can be performed since all the elements are odd. Thus, the answer\nis 0.\n\n* * *"}, {"input": "10\n 2184 2126 1721 1800 1024 2528 3360 1945 1280 1776", "output": "39"}]
Print the maximum number of operations that Snuke can perform. * * *
s757293477
Runtime Error
p03325
Input is given from Standard Input in the following format: N a_1 a_2 a_3 ... a_N
n=int(input()) a=[int(i) for i in input().split()] count=0 for ai in a: if ai%2==0: while ai!=1: ai=ai/=2 count+=1 print(count)
Statement As AtCoder Beginner Contest 100 is taking place, the office of AtCoder, Inc. is decorated with a sequence of length N, a = {a_1, a_2, a_3, ..., a_N}. Snuke, an employee, would like to play with this sequence. Specifically, he would like to repeat the following operation as many times as possible: For every i satisfying 1 \leq i \leq N, perform one of the following: "divide a_i by 2" and "multiply a_i by 3". Here, choosing "multiply a_i by 3" for every i is not allowed, and the value of a_i after the operation must be an integer. At most how many operations can be performed?
[{"input": "3\n 5 2 4", "output": "3\n \n\nThe sequence is initially {5, 2, 4}. Three operations can be performed as\nfollows:\n\n * First, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {15, 6, 2}.\n * Next, multiply a_1 by 3, divide a_2 by 2 and multiply a_3 by 3. The sequence is now {45, 3, 6}.\n * Finally, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {135, 9, 3}.\n\n* * *"}, {"input": "4\n 631 577 243 199", "output": "0\n \n\nNo operation can be performed since all the elements are odd. Thus, the answer\nis 0.\n\n* * *"}, {"input": "10\n 2184 2126 1721 1800 1024 2528 3360 1945 1280 1776", "output": "39"}]
Print the maximum number of operations that Snuke can perform. * * *
s206853687
Runtime Error
p03325
Input is given from Standard Input in the following format: N a_1 a_2 a_3 ... a_N
N = int(input()) A = list(map(int, input().split())) ans = 0 for i in len(A): while A[i] % 2 = 0: ans += 1 A[i] //= 2 print(ans)
Statement As AtCoder Beginner Contest 100 is taking place, the office of AtCoder, Inc. is decorated with a sequence of length N, a = {a_1, a_2, a_3, ..., a_N}. Snuke, an employee, would like to play with this sequence. Specifically, he would like to repeat the following operation as many times as possible: For every i satisfying 1 \leq i \leq N, perform one of the following: "divide a_i by 2" and "multiply a_i by 3". Here, choosing "multiply a_i by 3" for every i is not allowed, and the value of a_i after the operation must be an integer. At most how many operations can be performed?
[{"input": "3\n 5 2 4", "output": "3\n \n\nThe sequence is initially {5, 2, 4}. Three operations can be performed as\nfollows:\n\n * First, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {15, 6, 2}.\n * Next, multiply a_1 by 3, divide a_2 by 2 and multiply a_3 by 3. The sequence is now {45, 3, 6}.\n * Finally, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {135, 9, 3}.\n\n* * *"}, {"input": "4\n 631 577 243 199", "output": "0\n \n\nNo operation can be performed since all the elements are odd. Thus, the answer\nis 0.\n\n* * *"}, {"input": "10\n 2184 2126 1721 1800 1024 2528 3360 1945 1280 1776", "output": "39"}]
Print the maximum number of operations that Snuke can perform. * * *
s986846144
Runtime Error
p03325
Input is given from Standard Input in the following format: N a_1 a_2 a_3 ... a_N
N = int(input()) A = list(map(int,input().split())) K = 0 while !(len(A)==0): for i in range(len(A)): if(A[i]%2==0): A[i]==A[i]//2 K+=1 else: del A[i] print(K)
Statement As AtCoder Beginner Contest 100 is taking place, the office of AtCoder, Inc. is decorated with a sequence of length N, a = {a_1, a_2, a_3, ..., a_N}. Snuke, an employee, would like to play with this sequence. Specifically, he would like to repeat the following operation as many times as possible: For every i satisfying 1 \leq i \leq N, perform one of the following: "divide a_i by 2" and "multiply a_i by 3". Here, choosing "multiply a_i by 3" for every i is not allowed, and the value of a_i after the operation must be an integer. At most how many operations can be performed?
[{"input": "3\n 5 2 4", "output": "3\n \n\nThe sequence is initially {5, 2, 4}. Three operations can be performed as\nfollows:\n\n * First, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {15, 6, 2}.\n * Next, multiply a_1 by 3, divide a_2 by 2 and multiply a_3 by 3. The sequence is now {45, 3, 6}.\n * Finally, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {135, 9, 3}.\n\n* * *"}, {"input": "4\n 631 577 243 199", "output": "0\n \n\nNo operation can be performed since all the elements are odd. Thus, the answer\nis 0.\n\n* * *"}, {"input": "10\n 2184 2126 1721 1800 1024 2528 3360 1945 1280 1776", "output": "39"}]
Print the maximum number of operations that Snuke can perform. * * *
s303460351
Runtime Error
p03325
Input is given from Standard Input in the following format: N a_1 a_2 a_3 ... a_N
n=int(input()) a=list(map(int,input().split())) s=0 for _ i range(n): b=a[_] while b%2==0: b=b/2 s+=1 print(s)
Statement As AtCoder Beginner Contest 100 is taking place, the office of AtCoder, Inc. is decorated with a sequence of length N, a = {a_1, a_2, a_3, ..., a_N}. Snuke, an employee, would like to play with this sequence. Specifically, he would like to repeat the following operation as many times as possible: For every i satisfying 1 \leq i \leq N, perform one of the following: "divide a_i by 2" and "multiply a_i by 3". Here, choosing "multiply a_i by 3" for every i is not allowed, and the value of a_i after the operation must be an integer. At most how many operations can be performed?
[{"input": "3\n 5 2 4", "output": "3\n \n\nThe sequence is initially {5, 2, 4}. Three operations can be performed as\nfollows:\n\n * First, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {15, 6, 2}.\n * Next, multiply a_1 by 3, divide a_2 by 2 and multiply a_3 by 3. The sequence is now {45, 3, 6}.\n * Finally, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {135, 9, 3}.\n\n* * *"}, {"input": "4\n 631 577 243 199", "output": "0\n \n\nNo operation can be performed since all the elements are odd. Thus, the answer\nis 0.\n\n* * *"}, {"input": "10\n 2184 2126 1721 1800 1024 2528 3360 1945 1280 1776", "output": "39"}]
Print the maximum number of operations that Snuke can perform. * * *
s022751312
Runtime Error
p03325
Input is given from Standard Input in the following format: N a_1 a_2 a_3 ... a_N
n = int(input()) a = list(map(int,input().split())) ans = 0 for i in a: while(i % 2 ==0): i // = 2 ans += 1 print(ans)
Statement As AtCoder Beginner Contest 100 is taking place, the office of AtCoder, Inc. is decorated with a sequence of length N, a = {a_1, a_2, a_3, ..., a_N}. Snuke, an employee, would like to play with this sequence. Specifically, he would like to repeat the following operation as many times as possible: For every i satisfying 1 \leq i \leq N, perform one of the following: "divide a_i by 2" and "multiply a_i by 3". Here, choosing "multiply a_i by 3" for every i is not allowed, and the value of a_i after the operation must be an integer. At most how many operations can be performed?
[{"input": "3\n 5 2 4", "output": "3\n \n\nThe sequence is initially {5, 2, 4}. Three operations can be performed as\nfollows:\n\n * First, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {15, 6, 2}.\n * Next, multiply a_1 by 3, divide a_2 by 2 and multiply a_3 by 3. The sequence is now {45, 3, 6}.\n * Finally, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {135, 9, 3}.\n\n* * *"}, {"input": "4\n 631 577 243 199", "output": "0\n \n\nNo operation can be performed since all the elements are odd. Thus, the answer\nis 0.\n\n* * *"}, {"input": "10\n 2184 2126 1721 1800 1024 2528 3360 1945 1280 1776", "output": "39"}]
Print the maximum number of operations that Snuke can perform. * * *
s501314518
Runtime Error
p03325
Input is given from Standard Input in the following format: N a_1 a_2 a_3 ... a_N
n = int(input()) as = list(map(int, input().split())) r = 0 i = 1 while True: f = False for a in as: if a%2 == 0: a /= 2 r += 1 f = True if not f: break print(r)
Statement As AtCoder Beginner Contest 100 is taking place, the office of AtCoder, Inc. is decorated with a sequence of length N, a = {a_1, a_2, a_3, ..., a_N}. Snuke, an employee, would like to play with this sequence. Specifically, he would like to repeat the following operation as many times as possible: For every i satisfying 1 \leq i \leq N, perform one of the following: "divide a_i by 2" and "multiply a_i by 3". Here, choosing "multiply a_i by 3" for every i is not allowed, and the value of a_i after the operation must be an integer. At most how many operations can be performed?
[{"input": "3\n 5 2 4", "output": "3\n \n\nThe sequence is initially {5, 2, 4}. Three operations can be performed as\nfollows:\n\n * First, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {15, 6, 2}.\n * Next, multiply a_1 by 3, divide a_2 by 2 and multiply a_3 by 3. The sequence is now {45, 3, 6}.\n * Finally, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {135, 9, 3}.\n\n* * *"}, {"input": "4\n 631 577 243 199", "output": "0\n \n\nNo operation can be performed since all the elements are odd. Thus, the answer\nis 0.\n\n* * *"}, {"input": "10\n 2184 2126 1721 1800 1024 2528 3360 1945 1280 1776", "output": "39"}]
Print the maximum number of operations that Snuke can perform. * * *
s912410814
Runtime Error
p03325
Input is given from Standard Input in the following format: N a_1 a_2 a_3 ... a_N
D, N = map(int, input().split()) if D == 2: if N < 100: print(N * 10000) else: print(1010000) elif D == 1: if N < 100: print(N * 100) else: print(10100) else: if N < 100: print(N) else: print(101)
Statement As AtCoder Beginner Contest 100 is taking place, the office of AtCoder, Inc. is decorated with a sequence of length N, a = {a_1, a_2, a_3, ..., a_N}. Snuke, an employee, would like to play with this sequence. Specifically, he would like to repeat the following operation as many times as possible: For every i satisfying 1 \leq i \leq N, perform one of the following: "divide a_i by 2" and "multiply a_i by 3". Here, choosing "multiply a_i by 3" for every i is not allowed, and the value of a_i after the operation must be an integer. At most how many operations can be performed?
[{"input": "3\n 5 2 4", "output": "3\n \n\nThe sequence is initially {5, 2, 4}. Three operations can be performed as\nfollows:\n\n * First, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {15, 6, 2}.\n * Next, multiply a_1 by 3, divide a_2 by 2 and multiply a_3 by 3. The sequence is now {45, 3, 6}.\n * Finally, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {135, 9, 3}.\n\n* * *"}, {"input": "4\n 631 577 243 199", "output": "0\n \n\nNo operation can be performed since all the elements are odd. Thus, the answer\nis 0.\n\n* * *"}, {"input": "10\n 2184 2126 1721 1800 1024 2528 3360 1945 1280 1776", "output": "39"}]
Print the maximum number of operations that Snuke can perform. * * *
s374552896
Runtime Error
p03325
Input is given from Standard Input in the following format: N a_1 a_2 a_3 ... a_N
N = int(input()) a = [int(input()) for i in range(N) ] count = 0 for i in range(N): for j in range(len(a)): if a[j] % 2 == 0: count += 1 a[j] /= 2 print(count)
Statement As AtCoder Beginner Contest 100 is taking place, the office of AtCoder, Inc. is decorated with a sequence of length N, a = {a_1, a_2, a_3, ..., a_N}. Snuke, an employee, would like to play with this sequence. Specifically, he would like to repeat the following operation as many times as possible: For every i satisfying 1 \leq i \leq N, perform one of the following: "divide a_i by 2" and "multiply a_i by 3". Here, choosing "multiply a_i by 3" for every i is not allowed, and the value of a_i after the operation must be an integer. At most how many operations can be performed?
[{"input": "3\n 5 2 4", "output": "3\n \n\nThe sequence is initially {5, 2, 4}. Three operations can be performed as\nfollows:\n\n * First, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {15, 6, 2}.\n * Next, multiply a_1 by 3, divide a_2 by 2 and multiply a_3 by 3. The sequence is now {45, 3, 6}.\n * Finally, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {135, 9, 3}.\n\n* * *"}, {"input": "4\n 631 577 243 199", "output": "0\n \n\nNo operation can be performed since all the elements are odd. Thus, the answer\nis 0.\n\n* * *"}, {"input": "10\n 2184 2126 1721 1800 1024 2528 3360 1945 1280 1776", "output": "39"}]
Print the maximum number of operations that Snuke can perform. * * *
s199536869
Runtime Error
p03325
Input is given from Standard Input in the following format: N a_1 a_2 a_3 ... a_N
def num_divide_two(num: int): return int(format(num, 'b')[::-1].find("1")) N = int(input()) print(sum(map(num_divide_two, map(int, input().split())))
Statement As AtCoder Beginner Contest 100 is taking place, the office of AtCoder, Inc. is decorated with a sequence of length N, a = {a_1, a_2, a_3, ..., a_N}. Snuke, an employee, would like to play with this sequence. Specifically, he would like to repeat the following operation as many times as possible: For every i satisfying 1 \leq i \leq N, perform one of the following: "divide a_i by 2" and "multiply a_i by 3". Here, choosing "multiply a_i by 3" for every i is not allowed, and the value of a_i after the operation must be an integer. At most how many operations can be performed?
[{"input": "3\n 5 2 4", "output": "3\n \n\nThe sequence is initially {5, 2, 4}. Three operations can be performed as\nfollows:\n\n * First, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {15, 6, 2}.\n * Next, multiply a_1 by 3, divide a_2 by 2 and multiply a_3 by 3. The sequence is now {45, 3, 6}.\n * Finally, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {135, 9, 3}.\n\n* * *"}, {"input": "4\n 631 577 243 199", "output": "0\n \n\nNo operation can be performed since all the elements are odd. Thus, the answer\nis 0.\n\n* * *"}, {"input": "10\n 2184 2126 1721 1800 1024 2528 3360 1945 1280 1776", "output": "39"}]
Print the maximum number of operations that Snuke can perform. * * *
s273978611
Accepted
p03325
Input is given from Standard Input in the following format: N a_1 a_2 a_3 ... a_N
# 数列のすべての項の積を2で何回割れるか調べて出力する N = int(input()) ListA = [] A = input() ListA = A.split() ListB = [] for i in range(0, len(ListA), 1): ListB.append(int(ListA[i])) c = 0 S = 0 for i in range(0, len(ListB), 1): A = int(ListB[i]) while A % 2 == 0: A = A / 2 c += 1 else: S += c c = 0 print(S)
Statement As AtCoder Beginner Contest 100 is taking place, the office of AtCoder, Inc. is decorated with a sequence of length N, a = {a_1, a_2, a_3, ..., a_N}. Snuke, an employee, would like to play with this sequence. Specifically, he would like to repeat the following operation as many times as possible: For every i satisfying 1 \leq i \leq N, perform one of the following: "divide a_i by 2" and "multiply a_i by 3". Here, choosing "multiply a_i by 3" for every i is not allowed, and the value of a_i after the operation must be an integer. At most how many operations can be performed?
[{"input": "3\n 5 2 4", "output": "3\n \n\nThe sequence is initially {5, 2, 4}. Three operations can be performed as\nfollows:\n\n * First, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {15, 6, 2}.\n * Next, multiply a_1 by 3, divide a_2 by 2 and multiply a_3 by 3. The sequence is now {45, 3, 6}.\n * Finally, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {135, 9, 3}.\n\n* * *"}, {"input": "4\n 631 577 243 199", "output": "0\n \n\nNo operation can be performed since all the elements are odd. Thus, the answer\nis 0.\n\n* * *"}, {"input": "10\n 2184 2126 1721 1800 1024 2528 3360 1945 1280 1776", "output": "39"}]
Print the maximum number of operations that Snuke can perform. * * *
s842316224
Accepted
p03325
Input is given from Standard Input in the following format: N a_1 a_2 a_3 ... a_N
# WIP import sys sys_input = sys.stdin.readline N = int(sys_input()) aaa = list(map(int, sys_input().split())) # If all values are odd aaa_remain = set(map(lambda x: x % 2, aaa)) if len(aaa_remain) == 1 and sum(aaa_remain) == 1: print(0) exit() aaa_even = [a for a in aaa if a % 2 == 0] n_divide = 0 is_dividable = True for a in aaa_even: target_a = a while is_dividable: is_dividable = False if target_a % 2 else True if is_dividable: target_a = target_a // 2 n_divide += 1 is_dividable = True print(n_divide)
Statement As AtCoder Beginner Contest 100 is taking place, the office of AtCoder, Inc. is decorated with a sequence of length N, a = {a_1, a_2, a_3, ..., a_N}. Snuke, an employee, would like to play with this sequence. Specifically, he would like to repeat the following operation as many times as possible: For every i satisfying 1 \leq i \leq N, perform one of the following: "divide a_i by 2" and "multiply a_i by 3". Here, choosing "multiply a_i by 3" for every i is not allowed, and the value of a_i after the operation must be an integer. At most how many operations can be performed?
[{"input": "3\n 5 2 4", "output": "3\n \n\nThe sequence is initially {5, 2, 4}. Three operations can be performed as\nfollows:\n\n * First, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {15, 6, 2}.\n * Next, multiply a_1 by 3, divide a_2 by 2 and multiply a_3 by 3. The sequence is now {45, 3, 6}.\n * Finally, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {135, 9, 3}.\n\n* * *"}, {"input": "4\n 631 577 243 199", "output": "0\n \n\nNo operation can be performed since all the elements are odd. Thus, the answer\nis 0.\n\n* * *"}, {"input": "10\n 2184 2126 1721 1800 1024 2528 3360 1945 1280 1776", "output": "39"}]
Print the maximum number of operations that Snuke can perform. * * *
s705823432
Accepted
p03325
Input is given from Standard Input in the following format: N a_1 a_2 a_3 ... a_N
# coding: utf-8 import re import math from collections import defaultdict from collections import deque import itertools from copy import deepcopy import random import time import os import queue import sys import datetime from functools import lru_cache # @lru_cache(maxsize=None) readline = sys.stdin.readline sys.setrecursionlimit(2000000) # import numpy as np alphabet = "abcdefghijklmnopqrstuvwxyz" mod = int(10**9 + 7) inf = int(10**20) def yn(b): if b: print("yes") else: print("no") def Yn(b): if b: print("Yes") else: print("No") def YN(b): if b: print("YES") else: print("NO") class union_find: def __init__(self, n): self.n = n self.P = [a for a in range(N)] self.rank = [0] * n def find(self, x): if x != self.P[x]: self.P[x] = self.find(self.P[x]) return self.P[x] def same(self, x, y): return self.find(x) == self.find(y) def link(self, x, y): if self.rank[x] < self.rank[y]: self.P[x] = y elif self.rank[y] < self.rank[x]: self.P[y] = x else: self.P[x] = y self.rank[y] += 1 def unite(self, x, y): self.link(self.find(x), self.find(y)) def size(self): S = set() for a in range(self.n): S.add(self.find(a)) return len(S) def is_pow(a, b): # aはbの累乗数か now = b while now < a: now *= b if now == a: return True else: return False def bin_(num, size): A = [0] * size for a in range(size): if (num >> (size - a - 1)) & 1 == 1: A[a] = 1 else: A[a] = 0 return A def get_facs(n, mod_=0): A = [1] * (n + 1) for a in range(2, len(A)): A[a] = A[a - 1] * a if mod > 0: A[a] %= mod_ return A def comb(n, r, mod, fac): if n - r < 0: return 0 return (fac[n] * pow(fac[n - r], mod - 2, mod) * pow(fac[r], mod - 2, mod)) % mod def next_comb(num, size): x = num & (-num) y = num + x z = num & (~y) z //= x z = z >> 1 num = y | z if num >= (1 << size): return False else: return num def get_primes(n, type="int"): if n == 0: if type == "int": return [] else: return [False] A = [True] * (n + 1) A[0] = False A[1] = False for a in range(2, n + 1): if A[a]: for b in range(a * 2, n + 1, a): A[b] = False if type == "bool": return A B = [] for a in range(n + 1): if A[a]: B.append(a) return B def is_prime(num): if num <= 1: return False i = 2 while i * i <= num: if num % i == 0: return False i += 1 return True def ifelse(a, b, c): if a: return b else: return c def join(A, c=""): n = len(A) A = list(map(str, A)) s = "" for a in range(n): s += A[a] if a < n - 1: s += c return s def factorize(n, type_="dict"): b = 2 list_ = [] while b * b <= n: while n % b == 0: n //= b list_.append(b) b += 1 if n > 1: list_.append(n) if type_ == "dict": dic = {} for a in list_: if a in dic: dic[a] += 1 else: dic[a] = 1 return dic elif type_ == "list": return list_ else: return None def floor_(n, x=1): return x * (n // x) def ceil_(n, x=1): return x * ((n + x - 1) // x) return ret def seifu(x): return x // abs(x) ################################################### def main(): N = int(input()) A = list(map(int, input().split())) ni = [0] * N for a in range(N): now = A[a] cnt = 0 while now % 2 == 0: now //= 2 cnt += 1 ni[a] = cnt print(sum(ni)) main()
Statement As AtCoder Beginner Contest 100 is taking place, the office of AtCoder, Inc. is decorated with a sequence of length N, a = {a_1, a_2, a_3, ..., a_N}. Snuke, an employee, would like to play with this sequence. Specifically, he would like to repeat the following operation as many times as possible: For every i satisfying 1 \leq i \leq N, perform one of the following: "divide a_i by 2" and "multiply a_i by 3". Here, choosing "multiply a_i by 3" for every i is not allowed, and the value of a_i after the operation must be an integer. At most how many operations can be performed?
[{"input": "3\n 5 2 4", "output": "3\n \n\nThe sequence is initially {5, 2, 4}. Three operations can be performed as\nfollows:\n\n * First, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {15, 6, 2}.\n * Next, multiply a_1 by 3, divide a_2 by 2 and multiply a_3 by 3. The sequence is now {45, 3, 6}.\n * Finally, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {135, 9, 3}.\n\n* * *"}, {"input": "4\n 631 577 243 199", "output": "0\n \n\nNo operation can be performed since all the elements are odd. Thus, the answer\nis 0.\n\n* * *"}, {"input": "10\n 2184 2126 1721 1800 1024 2528 3360 1945 1280 1776", "output": "39"}]
Print the maximum number of operations that Snuke can perform. * * *
s759818989
Accepted
p03325
Input is given from Standard Input in the following format: N a_1 a_2 a_3 ... a_N
class Solver(object): def __init__(self): self.n = int(input()) self.a_s = list(map(int, input().split(" "))) self._evens = None def solve_archive(self): if len(self.evens) == 0: return 0 number = min(self.evens) def solve(self): print(sum(map(Solver.count_multiple_of_two, self.a_s))) @staticmethod def count_multiple_of_two(number): counter = 0 while number % 2 == 0: number /= 2 counter += 1 return counter @property def evens(self): if self._evens is None: self._evens = [] for a in self.a_s: if a % 2 == 0: self._evens.append(a) return self._evens if __name__ == "__main__": s = Solver() s.solve()
Statement As AtCoder Beginner Contest 100 is taking place, the office of AtCoder, Inc. is decorated with a sequence of length N, a = {a_1, a_2, a_3, ..., a_N}. Snuke, an employee, would like to play with this sequence. Specifically, he would like to repeat the following operation as many times as possible: For every i satisfying 1 \leq i \leq N, perform one of the following: "divide a_i by 2" and "multiply a_i by 3". Here, choosing "multiply a_i by 3" for every i is not allowed, and the value of a_i after the operation must be an integer. At most how many operations can be performed?
[{"input": "3\n 5 2 4", "output": "3\n \n\nThe sequence is initially {5, 2, 4}. Three operations can be performed as\nfollows:\n\n * First, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {15, 6, 2}.\n * Next, multiply a_1 by 3, divide a_2 by 2 and multiply a_3 by 3. The sequence is now {45, 3, 6}.\n * Finally, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {135, 9, 3}.\n\n* * *"}, {"input": "4\n 631 577 243 199", "output": "0\n \n\nNo operation can be performed since all the elements are odd. Thus, the answer\nis 0.\n\n* * *"}, {"input": "10\n 2184 2126 1721 1800 1024 2528 3360 1945 1280 1776", "output": "39"}]
Print the maximum number of operations that Snuke can perform. * * *
s036368502
Accepted
p03325
Input is given from Standard Input in the following format: N a_1 a_2 a_3 ... a_N
# -*- coding: utf-8 -*- import sys import itertools # これは色々使える組み込み関数みたいなやつ import math # 数学的計算はこれでいける。普通に0.5乗しても計算可能 # w=input() i = 0 j = 0 s = 0 N = int(input()) # Nori=N # D, N=input().split() # S=input() # T=input() # S_list=list(S) factor_list = list(map(int, input().split(" "))) def deletef(j): # 関数は必ずreturnすること if j % 2 == 0: return j / 2 else: j = 0 return j for i in range(10**13): factor_list = list(map(deletef, factor_list)) b = [x for x in factor_list if x >= 1] factor_list = b s = s + len(b) if len(b) == 0: break print(s) # M=int(input()) # drink_list = [list(map(int, input().split(" ")))for i in range(M)] # print(T_list[1]) # D=int(D) # N=int(N) # 不本意だが内包表記で二次元の空のリストを作成する # dp=[['' for i in range(2)] for j in range(N)] # absTH=[''for i in range(N)] # K=int(K) # S_list=[] # sentence_list=[] # total=0 # mojiretu="" # センテンスを暗記するのではなく、まずinput()を書いて、膨らます感じで記述する。すると#思考の流れ通りに書ける。素晴らしい! # for i in range(K): # ID_list.append(i+1) # print(ID_list) # for i in range(H) # この下の行が二次元リストの読み込 # intを消して記号を読み込めるようにしたしかしこれでは文字列から読み込んでいるのと同じ # weight_value_list = [list(input())for i in range(N)]#一文字づつばらして入れてしまう # s = [input() for i in range(N)] # 複数行に複数の入力値を取得し、出力する # sentence_list = (list(input())for i in range(N)) # for i in range(H): # ppixel_list=list(input()) # print(pixel_list) # high_pixel_list =[['' for i in range(W)]for j in range(2*H)] # print(high_pixel_list) # print(pixel_list[0][1])#行 列の順番にかっこが並んでいる # print(a_list) first_term = 0 second_term = 0 # 整数二次元配列を読み込む時のやり方 # a_b_c_list = [list(map(int, input().split(" ")))for i in range(N)] # センテンスを暗記するのではなく、まずinput()を書いて、膨らます感じで記述する。すると#思考の流れ通りに書ける。素晴らしい! # x, y = [0]*N, [0]*N#N個の空のリストを作成 # l = list(range(N))#範囲がNのリストを作成する # for i in range(N): # x[i], y[i] = map(int, input().split()) # 分けて入力する形式を設定することで可読性が高く仕上がっている # 素晴らしいことだ distance = 0 # comb = list(itertools.permutations(l)) # prmutation:英語の意味としては順列である """p[, r]で 長さrのタプル列、重複なしのあらゆる並びを表す 今回はリストlの重複なしの並び替え順序を新たなリストに収納している 並び方を計算しリストに収納しているイメージ l[0,1,2] l[0,2,1]これにもリスト番号が0,1,2と割り振られている これが全通り入っている これ作った人はすごい 自分も早く理解したい """ # for i in range(0, len(comb)):#i番目のパターンの時を考える。 # for j in range(0, N-1):#lのリスト番号を読み込み # distance += math.sqrt((x[comb[i][j]]-x[comb[i][j+1]])**2 + (y[comb[i][j]]-y[comb[i][j+1]])**2) """ 各経路の距離を足していき全距離分を経路数 で割れば平均距離が出るので各経路ごとの距離は 不必要と判断されている。 """ # print(distance/len(comb)) # dp[i+1][j]=max(dp[i][j]+a_b_c_list[i],dp[i][j],dp[i][j]) # リストを一周するようにすればいいのか
Statement As AtCoder Beginner Contest 100 is taking place, the office of AtCoder, Inc. is decorated with a sequence of length N, a = {a_1, a_2, a_3, ..., a_N}. Snuke, an employee, would like to play with this sequence. Specifically, he would like to repeat the following operation as many times as possible: For every i satisfying 1 \leq i \leq N, perform one of the following: "divide a_i by 2" and "multiply a_i by 3". Here, choosing "multiply a_i by 3" for every i is not allowed, and the value of a_i after the operation must be an integer. At most how many operations can be performed?
[{"input": "3\n 5 2 4", "output": "3\n \n\nThe sequence is initially {5, 2, 4}. Three operations can be performed as\nfollows:\n\n * First, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {15, 6, 2}.\n * Next, multiply a_1 by 3, divide a_2 by 2 and multiply a_3 by 3. The sequence is now {45, 3, 6}.\n * Finally, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {135, 9, 3}.\n\n* * *"}, {"input": "4\n 631 577 243 199", "output": "0\n \n\nNo operation can be performed since all the elements are odd. Thus, the answer\nis 0.\n\n* * *"}, {"input": "10\n 2184 2126 1721 1800 1024 2528 3360 1945 1280 1776", "output": "39"}]
Print the maximum number of operations that Snuke can perform. * * *
s301812338
Accepted
p03325
Input is given from Standard Input in the following format: N a_1 a_2 a_3 ... a_N
N = int(input()) List = list(map(int, input().split())) a = 0 for i in range(0, N): while List[i] % 2 == 0: a = a + 1 List[i] = List[i] / 2 print(a)
Statement As AtCoder Beginner Contest 100 is taking place, the office of AtCoder, Inc. is decorated with a sequence of length N, a = {a_1, a_2, a_3, ..., a_N}. Snuke, an employee, would like to play with this sequence. Specifically, he would like to repeat the following operation as many times as possible: For every i satisfying 1 \leq i \leq N, perform one of the following: "divide a_i by 2" and "multiply a_i by 3". Here, choosing "multiply a_i by 3" for every i is not allowed, and the value of a_i after the operation must be an integer. At most how many operations can be performed?
[{"input": "3\n 5 2 4", "output": "3\n \n\nThe sequence is initially {5, 2, 4}. Three operations can be performed as\nfollows:\n\n * First, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {15, 6, 2}.\n * Next, multiply a_1 by 3, divide a_2 by 2 and multiply a_3 by 3. The sequence is now {45, 3, 6}.\n * Finally, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {135, 9, 3}.\n\n* * *"}, {"input": "4\n 631 577 243 199", "output": "0\n \n\nNo operation can be performed since all the elements are odd. Thus, the answer\nis 0.\n\n* * *"}, {"input": "10\n 2184 2126 1721 1800 1024 2528 3360 1945 1280 1776", "output": "39"}]
If the objective is achievable, print `Yes`; if it is not, print `No`. * * *
s729372602
Wrong Answer
p02867
Input is given from Standard Input in the following format: N A_1 A_2 ... A_N B_1 B_2 ... B_N
N = int(input()) List = [[int(j) for j in input().split()] for i in range(2)] ans = 1 cnt = 0 aa = sorted(List[0]) bb = sorted(List[1]) for i in range(len(List[0])): a = List[0][List[0].index(aa[N - 1 - i])] b = List[1][List[0].index(aa[N - 1 - i])] num = List[0].index(aa[N - 1 - i]) if a > b: ind = List[1].index(bb[N - 1 - i]) c = List[0][ind] List[0][ind] = a List[0][num] = c cnt = cnt + 1 for i in range(len(List[0])): a = List[0][List[0].index(aa[N - 1 - i])] b = List[1][List[0].index(aa[N - 1 - i])] num = List[0].index(aa[N - 1 - i]) if a > b: ind = List[1].index(bb[N - 1 - i]) c = List[0][ind] List[0][ind] = a List[0][num] = c cnt = cnt + 1 for i in range(len(List[0])): a = List[0][List[0].index(aa[N - 1 - i])] b = List[1][List[0].index(aa[N - 1 - i])] num = List[0].index(aa[N - 1 - i]) if a > b: ind = List[1].index(bb[N - 1 - i]) c = List[0][ind] List[0][ind] = a List[0][num] = c cnt = cnt + 1 for i in range(len(List[0])): a = List[0][List[0].index(aa[N - 1 - i])] b = List[1][List[0].index(aa[N - 1 - i])] num = List[0].index(aa[N - 1 - i]) if a > b: ind = List[1].index(bb[N - 1 - i]) c = List[0][ind] List[0][ind] = a List[0][num] = c cnt = cnt + 1 for i in range(len(List[0])): a = List[0][List[0].index(aa[N - 1 - i])] b = List[1][List[0].index(aa[N - 1 - i])] num = List[0].index(aa[N - 1 - i]) if a > b: ind = List[1].index(bb[N - 1 - i]) c = List[0][ind] List[0][ind] = a List[0][num] = c cnt = cnt + 1 if cnt < N - 2: print("Yes") else: print("No")
Statement Given are two integer sequences of N elements each: A_1,...,A_N and B_1,...,B_N. Determine if it is possible to do the following operation at most N-2 times (possibly zero) so that, for every integer i from 1 to N, A_i \leq B_i holds: * Choose two distinct integers x and y between 1 and N (inclusive), and swap the values of A_x and A_y.
[{"input": "3\n 1 3 2\n 1 2 3", "output": "Yes\n \n\nWe should swap the values of A_2 and A_3.\n\n* * *"}, {"input": "3\n 1 2 3\n 2 2 2", "output": "No\n \n\n* * *"}, {"input": "6\n 3 1 2 6 3 4\n 2 2 8 3 4 3", "output": "Yes"}]
If the objective is achievable, print `Yes`; if it is not, print `No`. * * *
s267515086
Accepted
p02867
Input is given from Standard Input in the following format: N A_1 A_2 ... A_N B_1 B_2 ... B_N
import sys from bisect import bisect as br from collections import Counter readline = sys.stdin.readline def check(A, B): SA = sorted(A) SB = sorted(B) if any(a > b for a, b in zip(SA, SB)): return "No" if all(a <= b for a, b in zip(A, B)): return "Yes" if any(br(SA, SB[i]) != i + 1 for i in range(N)): return "Yes" if len(set(A)) != N or len(set(B)) != N: return "Yes" P = [None] * N Aidx = Counter() Bidx = Counter() for i in range(N): a = A[i] b = B[i] Aidx[a] = i Bidx[b] = i for i in range(N): sa = SA[i] sb = SB[i] P[Aidx[sa]] = Bidx[sb] visited = set() vn = 0 while vn not in visited: visited.add(vn) vn = P[vn] if len(visited) == N: return "No" return "Yes" N = int(readline()) A = list(map(int, readline().split())) B = list(map(int, readline().split())) print(check(A, B))
Statement Given are two integer sequences of N elements each: A_1,...,A_N and B_1,...,B_N. Determine if it is possible to do the following operation at most N-2 times (possibly zero) so that, for every integer i from 1 to N, A_i \leq B_i holds: * Choose two distinct integers x and y between 1 and N (inclusive), and swap the values of A_x and A_y.
[{"input": "3\n 1 3 2\n 1 2 3", "output": "Yes\n \n\nWe should swap the values of A_2 and A_3.\n\n* * *"}, {"input": "3\n 1 2 3\n 2 2 2", "output": "No\n \n\n* * *"}, {"input": "6\n 3 1 2 6 3 4\n 2 2 8 3 4 3", "output": "Yes"}]
If the objective is achievable, print `Yes`; if it is not, print `No`. * * *
s754647545
Wrong Answer
p02867
Input is given from Standard Input in the following format: N A_1 A_2 ... A_N B_1 B_2 ... B_N
from collections import Counter def even(N, A, sA): # 置換の偶奇性を数える d = {} for i, Ai in enumerate(A): d[Ai] = i # 重複ある場合に注意 cnt = 0 for i in range(N): if A[i] != sA[i]: A[i], A[d[sA[i]]] = A[d[sA[i]]], A[i] cnt += 1 return cnt % 2 == 0 N = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) f1 = True f2 = True f3 = True f4 = True sA = sorted(A[:]) sB = sorted(B[:]) for i in range(N): if sA[i] > sB[i]: f1 = False break if f1: CA = Counter(A) CB = Counter(B) vA = CA.values() vB = CB.values() if max(vA) >= 2 or max(vB) >= 2: f2 = True else: f2 = False if not f2: tA = even(N, A, sA) tB = even(N, B, sB) if tA != tB: f3 = True else: f3 = False if not f3: if sA[-1] <= sB[-2] and sA[-2] <= sB[-1]: f4 = True else: f4 = False if not f1: f = False elif f2: f = True elif f3: f = True elif f4: f = True else: f = False print("Yes" if f else "No")
Statement Given are two integer sequences of N elements each: A_1,...,A_N and B_1,...,B_N. Determine if it is possible to do the following operation at most N-2 times (possibly zero) so that, for every integer i from 1 to N, A_i \leq B_i holds: * Choose two distinct integers x and y between 1 and N (inclusive), and swap the values of A_x and A_y.
[{"input": "3\n 1 3 2\n 1 2 3", "output": "Yes\n \n\nWe should swap the values of A_2 and A_3.\n\n* * *"}, {"input": "3\n 1 2 3\n 2 2 2", "output": "No\n \n\n* * *"}, {"input": "6\n 3 1 2 6 3 4\n 2 2 8 3 4 3", "output": "Yes"}]
Print the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B. * * *
s203636441
Accepted
p03775
The input is given from Standard Input in the following format: N
n = int(input()) f = [10] * int(n**0.5) for a in range(int(n**0.5)): b = n / (a + 1) if b - int(b) == 0: f[a] = max(len(str(a)), len(str(int(b)))) print(min(f))
Statement You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B.
[{"input": "10000", "output": "3\n \n\nF(A,B) has a minimum value of 3 at (A,B)=(100,100).\n\n* * *"}, {"input": "1000003", "output": "7\n \n\nThere are two pairs (A,B) that satisfy the condition: (1,1000003) and\n(1000003,1). For these pairs, F(1,1000003)=F(1000003,1)=7.\n\n* * *"}, {"input": "9876543210", "output": "6"}]
Print the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B. * * *
s781902696
Wrong Answer
p03775
The input is given from Standard Input in the following format: N
import sys sys.setrecursionlimit(4100000) import math import logging logging.basicConfig(level=logging.DEBUG) logger = logging.getLogger(__name__) from collections import defaultdict d = defaultdict(list) import operator from functools import reduce def prod(iterable): return reduce(operator.mul, iterable, 1) # from itertools import combinations # comb = combinations(range(N), 2) # 累積和 # from itertools import accumulate # _list = list(accumulate(a_list) # from functools import lru_cache # @lru_cache(maxsize=None) # def setUp(self): # dp.cache_clear() def prime_factor(n: int): res = defaultdict(int) res[1] = 1 for i in range(2, math.ceil(math.sqrt(n))): while n % i == 0: res[i] += 1 n = n // i if n != 1: res[n] = 1 return res def flatten_key_count(d): return sum([[k for _ in range(d[k])] for k in d.keys()], []) def resolve(): # S = [x for x in sys.stdin.readline().split()][0] # 文字列 一つ N = [int(x) for x in sys.stdin.readline().split()][0] # int 一つ # N, D = [int(x) for x in sys.stdin.readline().split()] # 複数int # h_list = [int(x) for x in sys.stdin.readline().split()] # 複数int # grid = [list(sys.stdin.readline().split()[0]) for _ in range(N)] # 文字列grid # v_list = [int(sys.stdin.readline().split()[0]) for _ in range(N)] # grid = [[int(x) for x in sys.stdin.readline().split()] # for _ in range(N)] # int grid logger.debug("{}".format([])) factor_list = flatten_key_count(prime_factor(N)) _min = 10**10 for i in range(1, len(factor_list)): a = prod(factor_list[:i]) b = prod(factor_list[i:]) if a > b: _min = min(_min, len(str(a))) else: _min = min(_min, len(str(b))) print(_min) if __name__ == "__main__": resolve() # AtCoder Unit Test で自動生成できる, 最後のunittest.main は消す # python -m unittest template/template.py で実行できる # pypy3 -m unittest template/template.py で実行できる import sys from io import StringIO import unittest class TestClass(unittest.TestCase): def assertIO(self, input, output): stdout, stdin = sys.stdout, sys.stdin sys.stdout, sys.stdin = StringIO(), StringIO(input) resolve() sys.stdout.seek(0) out = sys.stdout.read()[:-1] sys.stdout, sys.stdin = stdout, stdin self.assertEqual(out, output) def test_入力例_1(self): input = """10000""" output = """3""" self.assertIO(input, output) def test_入力例_2(self): input = """1000003""" output = """7""" self.assertIO(input, output) def test_入力例_3(self): input = """9876543210""" output = """6""" self.assertIO(input, output)
Statement You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B.
[{"input": "10000", "output": "3\n \n\nF(A,B) has a minimum value of 3 at (A,B)=(100,100).\n\n* * *"}, {"input": "1000003", "output": "7\n \n\nThere are two pairs (A,B) that satisfy the condition: (1,1000003) and\n(1000003,1). For these pairs, F(1,1000003)=F(1000003,1)=7.\n\n* * *"}, {"input": "9876543210", "output": "6"}]
Print the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B. * * *
s809173443
Wrong Answer
p03775
The input is given from Standard Input in the following format: N
def 解(): iN = int(input()) iLim = int(iN**0.5) + 1 iNN = iN # とりあえず篩ながら素因数集める dS = {} aS = list(range(iLim + 1)) for i in range(2, iLim + 1): if aS[i]: if iNN % i == 0: dS[i] = 0 while iNN % i == 0: dS[i] += 1 iNN //= i if iNN == 1: break for j in range(i * 2, iLim + 1, i): aS[j] = 0 if 1 < iNN: print(len(str(iNN))) exit() # 半分にわけて余りをdSに集める iD = 1 for i in dS.copy(): if dS[i] % 2 == 0: iD *= i ** (dS[i] // 2) del dS[i] else: if 1 < dS[i]: iD *= i ** (dS[i] // 2) dS[i] = 1 if len(dS) == 0: print(len(str(iD))) elif len(dS) == 1: print(len(str(iD * list(dS.keys())[0]))) else: aS = sorted(list(dS.keys())) n = len(aS) iPr1 = aS[0] for i in range(1, n - 1): iPr1 *= aS[i] iMinMax = max(iPr1, aS[-1]) # 余りの素因数が多いと無理だがこれで通るかな? for i in range(0, n - 1): iA = aS[i] * aS[-1] iB = 1 for j in range(1, n - 1): if j != i: iB *= aS[j] iMinMax = min(iMinMax, max(iA, iB)) print(len(str(iD * iMinMax))) 解()
Statement You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B.
[{"input": "10000", "output": "3\n \n\nF(A,B) has a minimum value of 3 at (A,B)=(100,100).\n\n* * *"}, {"input": "1000003", "output": "7\n \n\nThere are two pairs (A,B) that satisfy the condition: (1,1000003) and\n(1000003,1). For these pairs, F(1,1000003)=F(1000003,1)=7.\n\n* * *"}, {"input": "9876543210", "output": "6"}]
Print the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B. * * *
s210236977
Accepted
p03775
The input is given from Standard Input in the following format: N
from collections import defaultdict n = int(input()) fact = defaultdict(int) fact[1] = 1 f = 2 k = n while f * f <= min(k * k, n): if k % f == 0: fact[f] += 1 k //= f else: f += 1 if k > 1: fact[k] += 1 def digits(n): ret = 0 while n > 0: ret += 1 n //= 10 return ret def dfs(index, mul, fact): if index >= len(fact): return max(digits(mul), digits(n // mul)) k, v = fact[index] ret = 10 for i in range(v + 1): ret = min(ret, dfs(index + 1, mul * pow(k, i), fact)) return ret print(dfs(0, 1, list(fact.items())))
Statement You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B.
[{"input": "10000", "output": "3\n \n\nF(A,B) has a minimum value of 3 at (A,B)=(100,100).\n\n* * *"}, {"input": "1000003", "output": "7\n \n\nThere are two pairs (A,B) that satisfy the condition: (1,1000003) and\n(1000003,1). For these pairs, F(1,1000003)=F(1000003,1)=7.\n\n* * *"}, {"input": "9876543210", "output": "6"}]
Print the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B. * * *
s203369814
Runtime Error
p03775
The input is given from Standard Input in the following format: N
N = int(input()) r_N = int(N ** (1 / 2)) li = [] for n in range(1,r_N + 1): if N % n == 0: a = N // n l = max(len(str(a)),len(str(n)))) li.append(l) print(min(li))
Statement You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B.
[{"input": "10000", "output": "3\n \n\nF(A,B) has a minimum value of 3 at (A,B)=(100,100).\n\n* * *"}, {"input": "1000003", "output": "7\n \n\nThere are two pairs (A,B) that satisfy the condition: (1,1000003) and\n(1000003,1). For these pairs, F(1,1000003)=F(1000003,1)=7.\n\n* * *"}, {"input": "9876543210", "output": "6"}]
Print the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B. * * *
s488601012
Accepted
p03775
The input is given from Standard Input in the following format: N
# @oj: atcoder # @id: hitwanyang # @email: [email protected] # @date: 2020-08-17 16:49 # @url:https://atcoder.jp/contests/abc057/tasks/abc057_c import sys, os from io import BytesIO, IOBase import collections, itertools, bisect, heapq, math, string from decimal import * # region fastio BUFSIZE = 8192 BUFSIZE = 8192 class FastIO(IOBase): newlines = 0 def __init__(self, file): self._fd = file.fileno() self.buffer = BytesIO() self.writable = "x" in file.mode or "r" not in file.mode self.write = self.buffer.write if self.writable else None def read(self): while True: b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE)) if not b: break ptr = self.buffer.tell() self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr) self.newlines = 0 return self.buffer.read() def readline(self): while self.newlines == 0: b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE)) self.newlines = b.count(b"\n") + (not b) ptr = self.buffer.tell() self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr) self.newlines -= 1 return self.buffer.readline() def flush(self): if self.writable: os.write(self._fd, self.buffer.getvalue()) self.buffer.truncate(0), self.buffer.seek(0) class IOWrapper(IOBase): def __init__(self, file): self.buffer = FastIO(file) self.flush = self.buffer.flush self.writable = self.buffer.writable self.write = lambda s: self.buffer.write(s.encode("ascii")) self.read = lambda: self.buffer.read().decode("ascii") self.readline = lambda: self.buffer.readline().decode("ascii") sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout) input = lambda: sys.stdin.readline().rstrip("\r\n") # ------------------------------ def main(): n = int(input()) ans = 20 for i in range(1, math.ceil(math.sqrt(n)) + 1): if n % i == 0: a, b = str(i), str(n // i) ans = min(ans, max(len(a), len(b))) print(ans) if __name__ == "__main__": main()
Statement You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B.
[{"input": "10000", "output": "3\n \n\nF(A,B) has a minimum value of 3 at (A,B)=(100,100).\n\n* * *"}, {"input": "1000003", "output": "7\n \n\nThere are two pairs (A,B) that satisfy the condition: (1,1000003) and\n(1000003,1). For these pairs, F(1,1000003)=F(1000003,1)=7.\n\n* * *"}, {"input": "9876543210", "output": "6"}]
Print the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B. * * *
s654045010
Wrong Answer
p03775
The input is given from Standard Input in the following format: N
import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time sys.setrecursionlimit(10**7) inf = 10**20 mod = 10**9 + 7 def LI(): return list(map(int, input().split())) def I(): return int(input()) def LS(): return input().split() def S(): return input() # Factoring by trial split def getPrimeList(n): l = [] t = int(math.sqrt(n)) + 1 for a in range(2, t): while n % a == 0: n //= a l.append(a) if n != 1: l.append(n) return l # 10 -> n def ten2n(a, n): x = a // n y = a % n if x: return ten2n(x, n) + str(y) return str(y) # 方針 # 入力値を素因数分解する # 制約のn<=10^10は、一見巨大に見えるが # 2^n でさえ(素因数が最大になる場合) # nは100にすら満たないことが実験するとわかる # すなわち全探索ができる # bit全探索を使用して各素数を振り分けを全パターン試す # 全パターンについて、F(A,B)の最小値を見ていく def main(): n = I() if n == 9876543210: exit() if n == 1: return 1 l = getPrimeList(n) l2 = [] for i in range(pow(2, len(l))): l2.append(list(ten2n(i, 2).zfill(len(l)))) mn = inf for y in l2: a = b = 1 for i in range(len(y)): x = y[i] if x == "0": a *= l[i] else: b *= l[i] mn = min(mn, max(len(str(a)), len(str(b)))) return mn print(main())
Statement You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B.
[{"input": "10000", "output": "3\n \n\nF(A,B) has a minimum value of 3 at (A,B)=(100,100).\n\n* * *"}, {"input": "1000003", "output": "7\n \n\nThere are two pairs (A,B) that satisfy the condition: (1,1000003) and\n(1000003,1). For these pairs, F(1,1000003)=F(1000003,1)=7.\n\n* * *"}, {"input": "9876543210", "output": "6"}]
Print the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B. * * *
s856534678
Accepted
p03775
The input is given from Standard Input in the following format: N
N = int(input()) M = int((N ** (1 / 2))) mult = 0 while 1: for i in [-1, 1]: x = M + i * mult if not N % x: print(max([len(str(x)), len(str(int(N / x)))])) exit() mult += 1
Statement You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B.
[{"input": "10000", "output": "3\n \n\nF(A,B) has a minimum value of 3 at (A,B)=(100,100).\n\n* * *"}, {"input": "1000003", "output": "7\n \n\nThere are two pairs (A,B) that satisfy the condition: (1,1000003) and\n(1000003,1). For these pairs, F(1,1000003)=F(1000003,1)=7.\n\n* * *"}, {"input": "9876543210", "output": "6"}]
Print the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B. * * *
s262186076
Runtime Error
p03775
The input is given from Standard Input in the following format: N
import math n=int(input()) ans = len(str(n)) for a in range(1,int(math.sqrt(n)+1)): if n % a == 0 and ans > max(len(str(a)),len(str(int(n / a)))) ans = max(len(str(a)),len(str(int(n / a)))) print(ans)
Statement You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B.
[{"input": "10000", "output": "3\n \n\nF(A,B) has a minimum value of 3 at (A,B)=(100,100).\n\n* * *"}, {"input": "1000003", "output": "7\n \n\nThere are two pairs (A,B) that satisfy the condition: (1,1000003) and\n(1000003,1). For these pairs, F(1,1000003)=F(1000003,1)=7.\n\n* * *"}, {"input": "9876543210", "output": "6"}]
Print the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B. * * *
s830747677
Runtime Error
p03775
The input is given from Standard Input in the following format: N
x
Statement You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B.
[{"input": "10000", "output": "3\n \n\nF(A,B) has a minimum value of 3 at (A,B)=(100,100).\n\n* * *"}, {"input": "1000003", "output": "7\n \n\nThere are two pairs (A,B) that satisfy the condition: (1,1000003) and\n(1000003,1). For these pairs, F(1,1000003)=F(1000003,1)=7.\n\n* * *"}, {"input": "9876543210", "output": "6"}]
Print the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B. * * *
s184984244
Runtime Error
p03775
The input is given from Standard Input in the following format: N
N = int(input()) divList = [] n = N while n != 1: if n % 2 == 0: n = n // 2 divList.append(2) continue if n % 3 == 0: n = n // 3 divList.append(3) continue newN = n isFind = False for i in range(6, (n ** (1 / 2)) + 1, 6): if n % (i - 1) == 0: divList.append(i - 1) newN = newN // (i - 1) isFind = True if n % (i + 1) == 0: divList.append(i + 1) newN = newN // (i + 1) isFind = True if isFind == True: break if isFind == False: divList.append(n) newN = 1 n = newN # print(divList) # print(divList) t = [([1], [1])] for d in divList: newT = [] for ab in t: a, b = ab[0], ab[1] a_add = a[:] a_add.append(d) b_add = b[:] b_add.append(d) newT.append((a, b_add)) newT.append((a_add, b)) t = newT # print(t) from functools import reduce a1 = [ (reduce(lambda a, b: a * b, ab[0]), reduce(lambda a, b: a * b, ab[1])) for ab in t ] # print(a1) a2 = set([(len(str(ab[0])), len(str(ab[1]))) for ab in a1]) # print(a2) a3 = [max(ab[0], ab[1]) for ab in a2] # print(a3) print(min(a3))
Statement You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B.
[{"input": "10000", "output": "3\n \n\nF(A,B) has a minimum value of 3 at (A,B)=(100,100).\n\n* * *"}, {"input": "1000003", "output": "7\n \n\nThere are two pairs (A,B) that satisfy the condition: (1,1000003) and\n(1000003,1). For these pairs, F(1,1000003)=F(1000003,1)=7.\n\n* * *"}, {"input": "9876543210", "output": "6"}]
Print the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B. * * *
s889561577
Runtime Error
p03775
The input is given from Standard Input in the following format: N
import math N=int(input()) a=0 for i in range(1,1+math.ceil(math.sqrt(N))): if N%i==0 and i>a: a=i b=int(N/a) print(max([len(str(a)),len(str(b))]))9876543210
Statement You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B.
[{"input": "10000", "output": "3\n \n\nF(A,B) has a minimum value of 3 at (A,B)=(100,100).\n\n* * *"}, {"input": "1000003", "output": "7\n \n\nThere are two pairs (A,B) that satisfy the condition: (1,1000003) and\n(1000003,1). For these pairs, F(1,1000003)=F(1000003,1)=7.\n\n* * *"}, {"input": "9876543210", "output": "6"}]
Print the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B. * * *
s344743803
Runtime Error
p03775
The input is given from Standard Input in the following format: N
from math imoprt sqrt n=int(input()) for i in range(int(sqrt(n)),0,-1): if n%i==0: print(max(len(str(i)),len(str(n//i)))) exit()
Statement You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B.
[{"input": "10000", "output": "3\n \n\nF(A,B) has a minimum value of 3 at (A,B)=(100,100).\n\n* * *"}, {"input": "1000003", "output": "7\n \n\nThere are two pairs (A,B) that satisfy the condition: (1,1000003) and\n(1000003,1). For these pairs, F(1,1000003)=F(1000003,1)=7.\n\n* * *"}, {"input": "9876543210", "output": "6"}]
Print the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B. * * *
s292532325
Runtime Error
p03775
The input is given from Standard Input in the following format: N
def divisible_length(n): min_length = len(str(n)) for i in range(1, int(n ** 0.5) + 1): if n % i == 0: min_length = min(min_length, len(str(i))) if i != n // i: min_length = min(min_length, len(str(n // i))) return min_length n = int(input()) print(divisible_length(n))
Statement You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B.
[{"input": "10000", "output": "3\n \n\nF(A,B) has a minimum value of 3 at (A,B)=(100,100).\n\n* * *"}, {"input": "1000003", "output": "7\n \n\nThere are two pairs (A,B) that satisfy the condition: (1,1000003) and\n(1000003,1). For these pairs, F(1,1000003)=F(1000003,1)=7.\n\n* * *"}, {"input": "9876543210", "output": "6"}]
Print the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B. * * *
s588937566
Runtime Error
p03775
The input is given from Standard Input in the following format: N
def f(a,b): digit_a = digit_b=0 while a: digit_a+=1 a//=10 while b: digit_b+=1 b//=10 return max(digit_a, digit_b) n = int(input()) ans = n for i in range(1, int((n+1)**0.5)): for n%i==0: n = min(n, f(i, n//i)) print(ans)
Statement You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B.
[{"input": "10000", "output": "3\n \n\nF(A,B) has a minimum value of 3 at (A,B)=(100,100).\n\n* * *"}, {"input": "1000003", "output": "7\n \n\nThere are two pairs (A,B) that satisfy the condition: (1,1000003) and\n(1000003,1). For these pairs, F(1,1000003)=F(1000003,1)=7.\n\n* * *"}, {"input": "9876543210", "output": "6"}]
Print the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B. * * *
s430027388
Runtime Error
p03775
The input is given from Standard Input in the following format: N
import math N = int(input()) end = int(math.sqrt(N))+1 ans = len(str(N)) for a in range(1,end): if N%a == 0: b = N//a ans = min(ans, len(str(max(a,b))) print(ans)
Statement You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B.
[{"input": "10000", "output": "3\n \n\nF(A,B) has a minimum value of 3 at (A,B)=(100,100).\n\n* * *"}, {"input": "1000003", "output": "7\n \n\nThere are two pairs (A,B) that satisfy the condition: (1,1000003) and\n(1000003,1). For these pairs, F(1,1000003)=F(1000003,1)=7.\n\n* * *"}, {"input": "9876543210", "output": "6"}]
Print the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B. * * *
s064367989
Runtime Error
p03775
The input is given from Standard Input in the following format: N
divisors = [] for i in range(1, int(n**0.5)+1): if n % i == 0: divisors.append(i) return divisors N=int(input()) div = make_divisors(N) A = div[-1] B = N//A print(max(len(str(A)),len(str(B))))
Statement You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B.
[{"input": "10000", "output": "3\n \n\nF(A,B) has a minimum value of 3 at (A,B)=(100,100).\n\n* * *"}, {"input": "1000003", "output": "7\n \n\nThere are two pairs (A,B) that satisfy the condition: (1,1000003) and\n(1000003,1). For these pairs, F(1,1000003)=F(1000003,1)=7.\n\n* * *"}, {"input": "9876543210", "output": "6"}]
Print the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B. * * *
s268146298
Runtime Error
p03775
The input is given from Standard Input in the following format: N
def prime_decomposition(n): i = 2 table = [] while i * i <= n: while n % i == 0: n //= i table.append(i) i += 1 if n > 1: table.append(n) return table N = int(input()) if N = 1: print(1) else: table = prime_decomposition(N) digN = len(str(N)) digMaxEle = len(str(table[-1])) if digN / 2 < digMaxEle: print(digMaxEle) else: print(digN//2 + digN%2)
Statement You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B.
[{"input": "10000", "output": "3\n \n\nF(A,B) has a minimum value of 3 at (A,B)=(100,100).\n\n* * *"}, {"input": "1000003", "output": "7\n \n\nThere are two pairs (A,B) that satisfy the condition: (1,1000003) and\n(1000003,1). For these pairs, F(1,1000003)=F(1000003,1)=7.\n\n* * *"}, {"input": "9876543210", "output": "6"}]
Print the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B. * * *
s566714356
Runtime Error
p03775
The input is given from Standard Input in the following format: N
import math N = int(input()) ans1 = 0 A = '1' B = str(N) if len(A)>=len(B): ans = len(A) else: ans = len(B) for i in range(2,int(math.sqrt(N)+1): A = i if N%A==0: B = int(N / A) A = str(A) B = str(B) if len(A)>=len(B): ans1 = len(A) else: ans1 = len(B) if ans1 <= ans: ans = ans1 if len(str(A))==len(str(B)): break print(ans)
Statement You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B.
[{"input": "10000", "output": "3\n \n\nF(A,B) has a minimum value of 3 at (A,B)=(100,100).\n\n* * *"}, {"input": "1000003", "output": "7\n \n\nThere are two pairs (A,B) that satisfy the condition: (1,1000003) and\n(1000003,1). For these pairs, F(1,1000003)=F(1000003,1)=7.\n\n* * *"}, {"input": "9876543210", "output": "6"}]
Print the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B. * * *
s245318923
Runtime Error
p03775
The input is given from Standard Input in the following format: N
#include <iostream> #include <sstream> #include <cstdio> #include <cstdlib> #include <cmath> #include <ctime> #include <cstring> #include <string> #include <vector> #include <stack> #include <queue> #include <deque> #include <map> #include <set> #include <bitset> #include <numeric> #include <utility> #include <iomanip> #include <algorithm> #include <functional> #include <unordered_map> using namespace std; #define REP(i, s) for (int i = 0; i < s; ++i) #define ALL(v) (v.begin(), v.end()) #define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl #define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i) template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } template <class T1, class T2> ostream &operator<<(ostream &s, pair<T1, T2> P) { return s << '<' << P.first << ", " << P.second << '>'; } template <class T> ostream &operator<<(ostream &s, vector<T> P) { for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; } template <class T> ostream &operator<<(ostream &s, vector<vector<T>> P) { for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; } template <class T> ostream &operator<<(ostream &s, set<T> P) { EACH(it, P) { s << "<" << *it << "> "; } return s << endl; } template <class T1, class T2> ostream &operator<<(ostream &s, map<T1, T2> P) { EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; } typedef long long ll; #define EPS (1e-7) #define INF (1e9) #define PI (acos(-1)) int func(long long num){ int cnt = 0; while (num > 0) { num /= 10; cnt++; } return cnt; } int main() { long long n; cin >> n; int ans = INF; for (int i = 1; i <= sqrt(n) + 1; i++) { int tmp=INF; if (n % i == 0) { tmp = max(func(i), func(n / i)); } ans = min(ans, tmp); } cout << ans << endl; }
Statement You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B.
[{"input": "10000", "output": "3\n \n\nF(A,B) has a minimum value of 3 at (A,B)=(100,100).\n\n* * *"}, {"input": "1000003", "output": "7\n \n\nThere are two pairs (A,B) that satisfy the condition: (1,1000003) and\n(1000003,1). For these pairs, F(1,1000003)=F(1000003,1)=7.\n\n* * *"}, {"input": "9876543210", "output": "6"}]
Print the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B. * * *
s545548904
Runtime Error
p03775
The input is given from Standard Input in the following format: N
N = int(input()) ans1 = 0 A = '1' B = str(N) if len(A)>=len(B): ans = len(A) else: ans = len(B) for i in range(2,int(math.sqrt(N)+1): A = i if N%A==0: B = int(N / A) A = str(A) B = str(B) if len(A)>=len(B): ans1 = len(A) else: ans1 = len(B) if ans1 <= ans: ans = ans1 if len(str(A))==len(str(B)): break print(ans)
Statement You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B.
[{"input": "10000", "output": "3\n \n\nF(A,B) has a minimum value of 3 at (A,B)=(100,100).\n\n* * *"}, {"input": "1000003", "output": "7\n \n\nThere are two pairs (A,B) that satisfy the condition: (1,1000003) and\n(1000003,1). For these pairs, F(1,1000003)=F(1000003,1)=7.\n\n* * *"}, {"input": "9876543210", "output": "6"}]
Print the string obtained by repeating the string `ACL` K times and concatenating them. * * *
s528506818
Wrong Answer
p02534
Input is given from Standard Input in the following format: K
print("acl" * int(input()))
Statement You are given an integer K. Print the string obtained by repeating the string `ACL` K times and concatenating them. For example, if K = 3, print `ACLACLACL`.
[{"input": "3", "output": "ACLACLACL"}]
Print the string obtained by repeating the string `ACL` K times and concatenating them. * * *
s200213957
Accepted
p02534
Input is given from Standard Input in the following format: K
cnt = int(input()) print("ACL" * cnt)
Statement You are given an integer K. Print the string obtained by repeating the string `ACL` K times and concatenating them. For example, if K = 3, print `ACLACLACL`.
[{"input": "3", "output": "ACLACLACL"}]
Print the string obtained by repeating the string `ACL` K times and concatenating them. * * *
s386686126
Accepted
p02534
Input is given from Standard Input in the following format: K
_str = "" _k = int(input()) for _i in range(_k): _str += "ACL" print(_str)
Statement You are given an integer K. Print the string obtained by repeating the string `ACL` K times and concatenating them. For example, if K = 3, print `ACLACLACL`.
[{"input": "3", "output": "ACLACLACL"}]
Print the string obtained by repeating the string `ACL` K times and concatenating them. * * *
s221635360
Accepted
p02534
Input is given from Standard Input in the following format: K
print(''.join(map(str, ["ACL" for _ in range(int(input()))])))
Statement You are given an integer K. Print the string obtained by repeating the string `ACL` K times and concatenating them. For example, if K = 3, print `ACLACLACL`.
[{"input": "3", "output": "ACLACLACL"}]
Print the string obtained by repeating the string `ACL` K times and concatenating them. * * *
s222682087
Accepted
p02534
Input is given from Standard Input in the following format: K
t = int(input()) str1 = "ACL" str2 = "" for i in range(0, t): str2 = str2[0:] + str1[0:] print(str2)
Statement You are given an integer K. Print the string obtained by repeating the string `ACL` K times and concatenating them. For example, if K = 3, print `ACLACLACL`.
[{"input": "3", "output": "ACLACLACL"}]
Print the string obtained by repeating the string `ACL` K times and concatenating them. * * *
s314365058
Wrong Answer
p02534
Input is given from Standard Input in the following format: K
print(input().strip() * 3)
Statement You are given an integer K. Print the string obtained by repeating the string `ACL` K times and concatenating them. For example, if K = 3, print `ACLACLACL`.
[{"input": "3", "output": "ACLACLACL"}]
Print the string obtained by repeating the string `ACL` K times and concatenating them. * * *
s325225686
Accepted
p02534
Input is given from Standard Input in the following format: K
def Next(): return input() def NextInt(): return int(Next()) def NextInts(): return map(int, input().split()) def Nexts(): return map(str, input().split()) def NextIntList(): return list(map(int, input().split())) def RowInts(n): return [input() for i in range(n)] k = int(input()) ans = "ACL" * k print(ans)
Statement You are given an integer K. Print the string obtained by repeating the string `ACL` K times and concatenating them. For example, if K = 3, print `ACLACLACL`.
[{"input": "3", "output": "ACLACLACL"}]
Print the string obtained by repeating the string `ACL` K times and concatenating them. * * *
s958181725
Accepted
p02534
Input is given from Standard Input in the following format: K
print(*["ACL"] * int(input()), sep="")
Statement You are given an integer K. Print the string obtained by repeating the string `ACL` K times and concatenating them. For example, if K = 3, print `ACLACLACL`.
[{"input": "3", "output": "ACLACLACL"}]
Print the string obtained by repeating the string `ACL` K times and concatenating them. * * *
s346609008
Wrong Answer
p02534
Input is given from Standard Input in the following format: K
k=int(input()) print("ACL*k")
Statement You are given an integer K. Print the string obtained by repeating the string `ACL` K times and concatenating them. For example, if K = 3, print `ACLACLACL`.
[{"input": "3", "output": "ACLACLACL"}]
Print the string obtained by repeating the string `ACL` K times and concatenating them. * * *
s136564964
Runtime Error
p02534
Input is given from Standard Input in the following format: K
print("ACL" * int(input))
Statement You are given an integer K. Print the string obtained by repeating the string `ACL` K times and concatenating them. For example, if K = 3, print `ACLACLACL`.
[{"input": "3", "output": "ACLACLACL"}]
Print the string obtained by repeating the string `ACL` K times and concatenating them. * * *
s269757353
Wrong Answer
p02534
Input is given from Standard Input in the following format: K
"ACL" * int(input())
Statement You are given an integer K. Print the string obtained by repeating the string `ACL` K times and concatenating them. For example, if K = 3, print `ACLACLACL`.
[{"input": "3", "output": "ACLACLACL"}]
Print the string obtained by repeating the string `ACL` K times and concatenating them. * * *
s866326813
Wrong Answer
p02534
Input is given from Standard Input in the following format: K
S = input() print(S * 3)
Statement You are given an integer K. Print the string obtained by repeating the string `ACL` K times and concatenating them. For example, if K = 3, print `ACLACLACL`.
[{"input": "3", "output": "ACLACLACL"}]
Print the string obtained by repeating the string `ACL` K times and concatenating them. * * *
s381144229
Runtime Error
p02534
Input is given from Standard Input in the following format: K
N, M = map(int, input().split()) notcalled = list(range(1, N + 1)) nets = [] for _ in range(M): a, b = map(int, input().split()) if a in notcalled and b in notcalled: nets.append([a, b]) del notcalled[notcalled.index(a)] del notcalled[notcalled.index(b)] elif a in notcalled: for net in nets: if b in net: net.append(a) del notcalled[notcalled.index(a)] elif b in notcalled: for net in nets: if a in net: net.append(b) del notcalled[notcalled.index(b)] else: for net in nets: f = True if a in net or b in net: if f: q = net.copy del net else: net.extend(q) nets.extend(notcalled) print(len(nets) - 1)
Statement You are given an integer K. Print the string obtained by repeating the string `ACL` K times and concatenating them. For example, if K = 3, print `ACLACLACL`.
[{"input": "3", "output": "ACLACLACL"}]
Print the string obtained by repeating the string `ACL` K times and concatenating them. * * *
s750843834
Accepted
p02534
Input is given from Standard Input in the following format: K
a = int(input()) b = [] m = [] for c in range(a): d = "ACL" b.append(d) m = "".join(b) print(m)
Statement You are given an integer K. Print the string obtained by repeating the string `ACL` K times and concatenating them. For example, if K = 3, print `ACLACLACL`.
[{"input": "3", "output": "ACLACLACL"}]
Print the string obtained by repeating the string `ACL` K times and concatenating them. * * *
s993422092
Accepted
p02534
Input is given from Standard Input in the following format: K
A = input() B = "ACL" C = "ACL" for i in range(int(A) - 1): B = B + C print(B)
Statement You are given an integer K. Print the string obtained by repeating the string `ACL` K times and concatenating them. For example, if K = 3, print `ACLACLACL`.
[{"input": "3", "output": "ACLACLACL"}]
Print the string obtained by repeating the string `ACL` K times and concatenating them. * * *
s803999062
Wrong Answer
p02534
Input is given from Standard Input in the following format: K
print("abc" * int(input()))
Statement You are given an integer K. Print the string obtained by repeating the string `ACL` K times and concatenating them. For example, if K = 3, print `ACLACLACL`.
[{"input": "3", "output": "ACLACLACL"}]
Print the string obtained by repeating the string `ACL` K times and concatenating them. * * *
s703471033
Runtime Error
p02534
Input is given from Standard Input in the following format: K
#!/usr/bin/env python import os import sys from io import BytesIO, IOBase def ii(): return int(input()) def si(): return input() def mi(): return map(int, input().strip().split(" ")) def li(): return list(mi()) def main(): # pass k = ii() return "ACL" * k print(main()) # region fastio BUFSIZE = 8192 class FastIO(IOBase): newlines = 0 def __init__(self, file): self._fd = file.fileno() self.buffer = BytesIO() self.writable = "x" in file.mode or "r" not in file.mode self.write = self.buffer.write if self.writable else None def read(self): while True: b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE)) if not b: break ptr = self.buffer.tell() self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr) self.newlines = 0 return self.buffer.read() def readline(self): while self.newlines == 0: b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE)) self.newlines = b.count(b"\n") + (not b) ptr = self.buffer.tell() self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr) self.newlines -= 1 return self.buffer.readline() def flush(self): if self.writable: os.write(self._fd, self.buffer.getvalue()) self.buffer.truncate(0), self.buffer.seek(0) class IOWrapper(IOBase): def __init__(self, file): self.buffer = FastIO(file) self.flush = self.buffer.flush self.writable = self.buffer.writable self.write = lambda s: self.buffer.write(s.encode("ascii")) self.read = lambda: self.buffer.read().decode("ascii") self.readline = lambda: self.buffer.readline().decode("ascii") sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout) input = lambda: sys.stdin.readline().rstrip("\r\n") # endregion if __name__ == "__main__": main()
Statement You are given an integer K. Print the string obtained by repeating the string `ACL` K times and concatenating them. For example, if K = 3, print `ACLACLACL`.
[{"input": "3", "output": "ACLACLACL"}]
Print the string obtained by repeating the string `ACL` K times and concatenating them. * * *
s042375305
Runtime Error
p02534
Input is given from Standard Input in the following format: K
n, m = map(int, input().split()) towns = [0] * n cnt = 1 def rewr(x, y, z): if x == y: return z else: return x for i in range(m): a, b = map(int, input().split()) a -= 1 b -= 1 if towns[a] == 0 and towns[b] == 0: towns[a] = cnt towns[b] = cnt cnt += 1 elif towns[a] > 0 and towns[b] == 0: towns[b] = towns[a] elif towns[b] > 0 and towns[a] == 0: towns[a] = towns[b] elif towns[a] > 0 and towns[b] > 0: if towns[a] != towns[b]: min_no = min(towns[a], towns[b]) max_no = max(towns[a], towns[b]) towns = [rewr(twn, max_no, min_no) for twn in towns] else: pass # print('pass') rslt = 0 # print(towns) rslt += max(towns) - 1 rslt += towns.count(0) print(rslt)
Statement You are given an integer K. Print the string obtained by repeating the string `ACL` K times and concatenating them. For example, if K = 3, print `ACLACLACL`.
[{"input": "3", "output": "ACLACLACL"}]
Print the string obtained by repeating the string `ACL` K times and concatenating them. * * *
s358681100
Runtime Error
p02534
Input is given from Standard Input in the following format: K
import sys readline = sys.stdin.readline from collections import Counter MOD = 998244353 def frac(limit): frac = [1] * limit for i in range(2, limit): frac[i] = i * frac[i - 1] % MOD fraci = [None] * limit fraci[-1] = pow(frac[-1], MOD - 2, MOD) for i in range(-2, -limit - 1, -1): fraci[i] = fraci[i + 1] * (limit + i + 1) % MOD return frac, fraci frac, fraci = frac(1341398) def comb(a, b): if not a >= b >= 0: return 0 return frac[a] * fraci[b] * fraci[a - b] % MOD pr = 3 LS = 20 class NTT: def __init__(self): self.N0 = 1 << LS omega = pow(pr, (MOD - 1) // self.N0, MOD) omegainv = pow(omega, MOD - 2, MOD) self.w = [0] * (self.N0 // 2) self.winv = [0] * (self.N0 // 2) self.w[0] = 1 self.winv[0] = 1 for i in range(1, self.N0 // 2): self.w[i] = (self.w[i - 1] * omega) % MOD self.winv[i] = (self.winv[i - 1] * omegainv) % MOD used = set() for i in range(self.N0 // 2): if i in used: continue j = 0 for k in range(LS - 1): j |= (i >> k & 1) << (LS - 2 - k) used.add(j) self.w[i], self.w[j] = self.w[j], self.w[i] self.winv[i], self.winv[j] = self.winv[j], self.winv[i] def _fft(self, A): M = len(A) bn = 1 hbs = M >> 1 while hbs: for j in range(hbs): A[j], A[j + hbs] = A[j] + A[j + hbs], A[j] - A[j + hbs] if A[j] > MOD: A[j] -= MOD if A[j + hbs] < 0: A[j + hbs] += MOD for bi in range(1, bn): wi = self.w[bi] for j in range(bi * hbs * 2, bi * hbs * 2 + hbs): A[j], A[j + hbs] = (A[j] + wi * A[j + hbs]) % MOD, ( A[j] - wi * A[j + hbs] ) % MOD bn <<= 1 hbs >>= 1 def _ifft(self, A): M = len(A) bn = M >> 1 hbs = 1 while bn: for j in range(hbs): A[j], A[j + hbs] = A[j] + A[j + hbs], A[j] - A[j + hbs] if A[j] > MOD: A[j] -= MOD if A[j + hbs] < 0: A[j + hbs] += MOD for bi in range(1, bn): winvi = self.winv[bi] for j in range(bi * hbs * 2, bi * hbs * 2 + hbs): A[j], A[j + hbs] = (A[j] + A[j + hbs]) % MOD, winvi * ( A[j] - A[j + hbs] ) % MOD bn >>= 1 hbs <<= 1 def convolve(self, A, B): LA = len(A) LB = len(B) LC = LA + LB - 1 M = 1 << (LC - 1).bit_length() A += [0] * (M - LA) B += [0] * (M - LB) self._fft(A) self._fft(B) C = [0] * M for i in range(M): C[i] = A[i] * B[i] % MOD self._ifft(C) minv = pow(M, MOD - 2, MOD) for i in range(LC): C[i] = C[i] * minv % MOD return C[:LC] return C def inverse(self, A): LA = len(A) dep = (LA - 1).bit_length() M = 1 << dep A += [0] * (M - LA) g = [pow(A[0], MOD - 2, MOD)] for n in range(dep): dl = 1 << (n + 1) f = A[:dl] fg = self.convolve(f, g[:])[:dl] fgg = self.convolve(fg, g[:])[:dl] ng = [None] * dl for i in range(dl // 2): ng[i] = (2 * g[i] - fgg[i]) % MOD for i in range(dl // 2, dl): ng[i] = MOD - fgg[i] g = ng[:] return g[:LA] def integral(self, A): A = [1] + [A[i] * fraci[i + 2] % MOD for i in range(len(A))] N = int(readline()) H = [int(readline()) for _ in range(2 * N)] Ch = list(Counter(H).values()) Ch.sort() table = [] for c in Ch: res = [0] * (c // 2 + 1) for i in range(c // 2 + 1): res[i] = comb(c, 2 * i) * frac[2 * i] * fraci[i] % MOD table.append(res) M = len(Ch) FT = NTT() for i in range(M.bit_length() - 1): s = 1 << i for st in range(0, M - s, 2 * s): table[st] = FT.convolve(table[st], table[st + s]) table[st + s] = None res = [1] for s in table[::-1]: if s is not None: res = FT.convolve(s, res) ans = 0 for i in range(len(res)): ans = ( ans + (-1 if i & 1 else 1) * res[i] * comb(N, i) * frac[2 * N - 2 * i] * frac[i] ) % MOD ans = ans * pow((MOD + 1) // 2, N, MOD) * fraci[N] % MOD print(ans)
Statement You are given an integer K. Print the string obtained by repeating the string `ACL` K times and concatenating them. For example, if K = 3, print `ACLACLACL`.
[{"input": "3", "output": "ACLACLACL"}]
Print the string obtained by repeating the string `ACL` K times and concatenating them. * * *
s087430609
Runtime Error
p02534
Input is given from Standard Input in the following format: K
print(eval("'ACL'*input()"))
Statement You are given an integer K. Print the string obtained by repeating the string `ACL` K times and concatenating them. For example, if K = 3, print `ACLACLACL`.
[{"input": "3", "output": "ACLACLACL"}]
Print the string obtained by repeating the string `ACL` K times and concatenating them. * * *
s014261606
Wrong Answer
p02534
Input is given from Standard Input in the following format: K
print("ALC" * int(input()))
Statement You are given an integer K. Print the string obtained by repeating the string `ACL` K times and concatenating them. For example, if K = 3, print `ACLACLACL`.
[{"input": "3", "output": "ACLACLACL"}]
Print two integers x and y separated by a space. If there are several pairs of such x and y, print that pair for which |x| + |y| is the minimal (primarily) and x ≤ y (secondarily).
s372781250
Accepted
p02471
a b Two positive integers a and b are given separated by a space in a line.
a, b = map(int, input().split()) c = g = 1 e = f = 0 while b: d, m = divmod(a, b) h = c - d * e i = f - d * g a, b = b, m c, e = e, h f, g = g, i print(c, f)
Extended Euclid Algorithm Given positive integers a and b, find the integer solution (x, y) to ax + by = gcd(a, b), where gcd(a, b) is the greatest common divisor of a and b.
[{"input": "4 12", "output": "1 0"}, {"input": "3 8", "output": "3 -1"}]
Print two integers x and y separated by a space. If there are several pairs of such x and y, print that pair for which |x| + |y| is the minimal (primarily) and x ≤ y (secondarily).
s200650039
Accepted
p02471
a b Two positive integers a and b are given separated by a space in a line.
# -*- coding: utf-8 -*- import sys def input(): return sys.stdin.readline().strip() def list2d(a, b, c): return [[c] * b for i in range(a)] def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)] def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)] def ceil(x, y=1): return int(-(-x // y)) def INT(): return int(input()) def MAP(): return map(int, input().split()) def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)] def Yes(): print("Yes") def No(): print("No") def YES(): print("YES") def NO(): print("NO") sys.setrecursionlimit(10**9) INF = float("inf") MOD = 10**9 + 7 # 拡張ユークリッドの互除法(ax+by=gcd(a, b)の解を求める) def extgcd(a, b, x, y): if b == 0: x = 1 y = 0 return (y, x) else: x, y = extgcd(b, a % b, y, x) y -= a // b * x return (y, x) a, b = MAP() y, x = extgcd(a, b, 0, 0) print(x, y)
Extended Euclid Algorithm Given positive integers a and b, find the integer solution (x, y) to ax + by = gcd(a, b), where gcd(a, b) is the greatest common divisor of a and b.
[{"input": "4 12", "output": "1 0"}, {"input": "3 8", "output": "3 -1"}]
If there is an integer C between 1 and 3 that satisfies the condition, print `Yes`; otherwise, print `No`. * * *
s232124986
Accepted
p03260
Input is given from Standard Input in the following format: A B
print(["No", "Yes"][eval(input().replace(" ", "*")) % 2])
Statement You are given integers A and B, each between 1 and 3 (inclusive). Determine if there is an integer C between 1 and 3 (inclusive) such that A \times B \times C is an odd number.
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
If there is an integer C between 1 and 3 that satisfies the condition, print `Yes`; otherwise, print `No`. * * *
s855155639
Accepted
p03260
Input is given from Standard Input in the following format: A B
print(["Yes", "No"][eval(input().replace(" ", "*")) % 2 == 0])
Statement You are given integers A and B, each between 1 and 3 (inclusive). Determine if there is an integer C between 1 and 3 (inclusive) such that A \times B \times C is an odd number.
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
If there is an integer C between 1 and 3 that satisfies the condition, print `Yes`; otherwise, print `No`. * * *
s163677586
Wrong Answer
p03260
Input is given from Standard Input in the following format: A B
0
Statement You are given integers A and B, each between 1 and 3 (inclusive). Determine if there is an integer C between 1 and 3 (inclusive) such that A \times B \times C is an odd number.
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
If there is an integer C between 1 and 3 that satisfies the condition, print `Yes`; otherwise, print `No`. * * *
s948070534
Accepted
p03260
Input is given from Standard Input in the following format: A B
a, b = [int(w) for w in input().split()] cond = a * b % 2 == 1 print("Yes" if cond else "No")
Statement You are given integers A and B, each between 1 and 3 (inclusive). Determine if there is an integer C between 1 and 3 (inclusive) such that A \times B \times C is an odd number.
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
If there is an integer C between 1 and 3 that satisfies the condition, print `Yes`; otherwise, print `No`. * * *
s800670592
Runtime Error
p03260
Input is given from Standard Input in the following format: A B
a,b=map(int,input().split()) if a%2== and b%2==0: print("Yes") else: print("No")
Statement You are given integers A and B, each between 1 and 3 (inclusive). Determine if there is an integer C between 1 and 3 (inclusive) such that A \times B \times C is an odd number.
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
If there is an integer C between 1 and 3 that satisfies the condition, print `Yes`; otherwise, print `No`. * * *
s240755614
Runtime Error
p03260
Input is given from Standard Input in the following format: A B
A,B=map(int,input().split()) if A % 2 == 1 and B % 2 ==1: print("Yes") eise: print("No")
Statement You are given integers A and B, each between 1 and 3 (inclusive). Determine if there is an integer C between 1 and 3 (inclusive) such that A \times B \times C is an odd number.
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
If there is an integer C between 1 and 3 that satisfies the condition, print `Yes`; otherwise, print `No`. * * *
s882242458
Accepted
p03260
Input is given from Standard Input in the following format: A B
from collections import defaultdict, deque, Counter from heapq import heappush, heappop, heapify from itertools import ( permutations, accumulate, combinations, combinations_with_replacement, ) from math import sqrt, ceil, floor, factorial from bisect import bisect_left, bisect_right, insort_left, insort_right from copy import deepcopy from operator import itemgetter from functools import reduce from fractions import gcd import sys def input(): return sys.stdin.readline().rstrip() def I(): return int(input()) def Is(): return map(int, input().split()) def LI(): return list(map(int, input().split())) def TI(): return tuple(map(int, input().split())) def IR(n): return [I() for _ in range(n)] def LIR(n): return [LI() for _ in range(n)] def TIR(n): return [TI() for _ in range(n)] def S(): return input() def Ss(): return input().split() def LS(): return list(input()) def SR(n): return [S() for _ in range(n)] def SsR(n): return [Ss() for _ in range(n)] def LSR(n): return [LS() for _ in range(n)] sys.setrecursionlimit(10**6) MOD = 10**9 + 7 INF = 10**18 # ----------------------------------------------------------- # a, b = Is() if a * b % 2 != 0: print("Yes") else: print("No")
Statement You are given integers A and B, each between 1 and 3 (inclusive). Determine if there is an integer C between 1 and 3 (inclusive) such that A \times B \times C is an odd number.
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
If there is an integer C between 1 and 3 that satisfies the condition, print `Yes`; otherwise, print `No`. * * *
s746090342
Runtime Error
p03260
Input is given from Standard Input in the following format: A B
#!usr/bin/env python3 from collections import defaultdict from collections import deque from heapq import heappush, heappop import sys import math import bisect import random def LI(): return list(map(int, sys.stdin.readline().split())) def I(): return int(sys.stdin.readline()) def LS(): return list(map(list, sys.stdin.readline().split())) def S(): return list(sys.stdin.readline())[:-1] def IR(n): l = [None for i in range(n)] for i in range(n): l[i] = I() return l def LIR(n): l = [None for i in range(n)] for i in range(n): l[i] = LI() return l def SR(n): l = [None for i in range(n)] for i in range(n): l[i] = S() return l def LSR(n): l = [None for i in range(n)] for i in range(n): l[i] = LS() return l sys.setrecursionlimit(1000000) mod = 1000000007 # A def A(): a, b, c = LI() print(9 * max(a, b, c) + a + b + c) return # B def B(): a, b = LI() if a * b % 2: print("Yes") else: print("No") return # C def C(): return # D def D(): return # E def E(): return # F def F(): return # G def G(): return # H def H(): return # I def I_(): return # J def J(): return # Solve if __name__ == "__main__": A()
Statement You are given integers A and B, each between 1 and 3 (inclusive). Determine if there is an integer C between 1 and 3 (inclusive) such that A \times B \times C is an odd number.
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
If there is an integer C between 1 and 3 that satisfies the condition, print `Yes`; otherwise, print `No`. * * *
s501542792
Runtime Error
p03260
Input is given from Standard Input in the following format: A B
A, B = map(int, input().split()) flg = True for i in range(1, 4): if (A * B * i) % 2 == 1: flg = False break if flg == False: print('Yes') elif == True: print('No')
Statement You are given integers A and B, each between 1 and 3 (inclusive). Determine if there is an integer C between 1 and 3 (inclusive) such that A \times B \times C is an odd number.
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
If there is an integer C between 1 and 3 that satisfies the condition, print `Yes`; otherwise, print `No`. * * *
s227408134
Runtime Error
p03260
Input is given from Standard Input in the following format: A B
A, B = map(int, input().split()) for i in range(1, 4): x = A *B *i if ((x % 2) == 1): print('Yes') break else: print('No')
Statement You are given integers A and B, each between 1 and 3 (inclusive). Determine if there is an integer C between 1 and 3 (inclusive) such that A \times B \times C is an odd number.
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]
If there is an integer C between 1 and 3 that satisfies the condition, print `Yes`; otherwise, print `No`. * * *
s266671400
Runtime Error
p03260
Input is given from Standard Input in the following format: A B
a,b=(int(x) for x in input().split()) if a//2==0 and b//2==0: print(“YES”) else: (“NO”)
Statement You are given integers A and B, each between 1 and 3 (inclusive). Determine if there is an integer C between 1 and 3 (inclusive) such that A \times B \times C is an odd number.
[{"input": "3 1", "output": "Yes\n \n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an\nodd number.\n\n* * *"}, {"input": "1 2", "output": "No\n \n\n* * *"}, {"input": "2 2", "output": "No"}]