This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
puts "moke" #文字列 | |
puts ans # 変数も可 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
str = gets |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
moke = [] | |
N.times { moke << gets.to_i } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hoge = gets.split.map(&:to_i) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
N,M = gets.split.map(&:to_i) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
N = gets.to_i |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
N = gets.to_i | |
hoge = gets.split.map(&:to_i) | |
#ここまで入力 | |
hoge.sort! #小さい順にソート | |
hoge.reverse! #それを逆順にひっくり返すことによって実質大きい順ソートに | |
s = 0 #これが偶数の時はAliceの番で、奇数の時はBobの番 | |
Alice = 0 | |
Bob = 0 | |
while s < N | |
if(s%2==0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
A = gets.to_i | |
B = gets.to_i | |
C = gets.to_i | |
X = gets.to_i | |
#ここまで入力 | |
ans = 0 | |
a = 0 #500円玉の枚数 | |
while a != A+1 do | |
b = 0 #100円玉の枚数 | |
while b != B+1 do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
N = gets.to_i | |
x = [] | |
y = [] | |
t = [] | |
N.times do | |
line = gets.split.map(&:to_i) | |
t << line[0] | |
x << line[1] | |
y << line[2] | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Y,N = gets.split.map(&:to_i) #入力 | |
a = 0 #一万円の枚数 | |
while a * 10000 <= N | |
b = 0 #5000円の枚数 | |
while b * 5000 + a * 10000 <= N | |
c = (N - (a * 10000 + b * 5000)) / 1000 #1万円の枚数と5000円の枚数が決まれば、考えられる千円札の枚数は一意に決まる。 | |
if(a+b+c==Y&&a*10000+b*5000+c*1000==N) #枚数がYかつ合計金額がNなら出力して終了 | |
puts "#{a} #{b} #{c}" | |
exit | |
end |
NewerOlder