Last active
January 10, 2019 09:17
-
-
Save kou029w/4905fd94df5032b1ecda9f867b355c6c to your computer and use it in GitHub Desktop.
This file contains hidden or 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
開始
長さ 4 の文字列がDDCC型文字列であるのは、文字列の 1 文字目と 2 文字目が等しく、 2 文字目と 3 文字目が異なり、 3 文字目と 4 文字目が等しいときです。
理解
{ grep -o . | xargs -n2 | awk '{if ($1 == $2) a[i++] = $1; print $1} END{if (a[0] && a[1] && a[0] != a[1]) print "Yes" ; else print "No"}';}
これはひどい
そして0点...
grep -o . | xargs -n2 | awk '{if ($1 == $2) a[i++] = $1} END{if (a[0] && a[1] && a[0] != a[1]) print "Yes"; else print "No"}'
次いこう
read a b c d; echo $((a*1728 + b*144 + c*12 + d))
すこしまとも
yatta-
次いこう
http://ddcc2017-qual.contest.atcoder.jp/tasks/ddcc2017_qual_c
bashだとめんどうそうなやつだ...パス
もう無理だ、しにたくなってきた
残り30分もあるし http://ddcc2017-qual.contest.atcoder.jp/tasks/ddcc2017_qual_c でもやるか...
2本収納するなよ...
ruby インストールしよう
sudo apt install ruby
- 長さが長すぎやつは無視すればよい
- 長さが長さなら +1
- 長さ+1 が長さなら +1
- 長さ+1 未満の時は後で考える
長さ+1未満の集合は、順番に a+b+1 試すか...
残った分も後で加える
ruby -v
ruby 2.3.1p112 (2016-04-26) [x86_64-linux-gnu]
while str = STDIN.gets
end
これで標準入力が取得できるんだ...知らなかった
n, c = STDIN.gets.split(' ').map(&:to_i)
l=[]
while i = STDIN.gets
l << i.to_i
end
l.delete_if {|i| i > c }
sum = 0
l.each {|i| sum += (i == c || i + 1 == c ? 1 : 0) }.delete_if {|i| i == c || i + 1 == c }
l.sort!
while i = l.pop
sum+=1
l.each do|j|
if i + j + 1 <= c
l-=[j]
break
end
end
end
puts sum
1時間50分もかかった
間違えてた
n, c = STDIN.gets.split(' ').map(&:to_i)
l=[]
while i = STDIN.gets
l << i.to_i
end
sum = 0
l.each {|i| sum += (i == c || i + 1 == c ? 1 : 0) }.delete_if {|i| i == c || i + 1 == c }
l.sort!
while i = l.pop
sum+=1
l.each_with_index do |j,ix|
if i + j + 1 <= c
l.delete_at(ix)
break
end
end
end
puts sum
TLEだ
整理した
n, c = STDIN.gets.split(' ').map(&:to_i)
sum = 0
l = STDIN.read.split("\n").map(&:to_i).each {|i| sum += (i == c || i + 1 == c ? 1 : 0) }.delete_if {|i| i == c || i + 1 == c }.sort
while i = l.pop
sum+=1
l.each_with_index do |j,ix|
if i + j + 1 <= c
l.delete_at(ix)
break
end
end
end
puts sum
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
事前準備
Windows アップデートが始まったので待つ
VSCodeもアップデート
Ubuntuもアップデート