@ >>58のコードでの誤記の指摘は概ね正解 ただ>>58のコードの修正だけでは紀元前に対応していない 紀元前が対応するように修正しなさい A @のプログラムの通日を整数の通ナノ秒にして、ナノ秒までの時刻を正確に相互変換できるようにしなさい B Aにうるう秒をいれて正確に相互変換できるようにしなさい(制約で問題が発生する場合、問題が発生する時刻を書きなさい) 参考URL:http://maia.usno.navy.mil/ser7/tai-utc.dat
・International Atomic Time (TAI) - SI second defined by frequency of hyperfine transition of cesium133 - Measured and counted with international network of atomic clocks
・Co-ordinated Universal Time (UTC) - Our civil time (in winter) - Based on SI second, with 86400s/day - Kept synchronised with UT1 since 1972 by addition of leap seconds - Leap seconds not added to TAI, so TAI-UTC is not constant - Currently (Nov 2012) TAI - UTC = 35s - Use of leap secs currently under discussion (inconvenient for astro)
・Co-ordinated Universal Time (UTC) - Currently (Nov 2012) TAI - UTC = 35s
・Calendar is independent of time system, so state both, e.g. - 2011 November 11 11:00:00.0 UTC - 2011 November 11 11:00:34.0 TAI - JD 2455876.958333 UTC - JD 2455876.958727 TAI
これはおかしいだろう 0096デフォルトの名無しさん2018/10/12(金) 02:23:49.18ID:I/tzu8NI>>95 ruby n = 10 Prime.reduce(0){|s, i|break(s) if i > n; s + i} 0097デフォルトの名無しさん2018/10/12(金) 02:35:54.36ID:xbwLlD7o え?じゃ、こんな感じ?
NB. monadic operator returns count of a_n > b_n NB. where a and b is sorted y-length array of rand(1000) do1=: verb define a =. sort ?y$1000 b =. sort ?y$1000 +/ (a>b) )
NB. dyad operator returns count of number x in array y count=: dyad define +/ (x = y) )
| N M random bag | N := 10. M := 1e6. random := Random new. bag := Bag new. M timesRepeat: [ | pairs count | pairs := (random next: N) with: (random next: N) collect: [:a :b | {a. b}]. count := pairs count: [:pair | [:a :b | a > b] valueWithArguments: pair]. bag add: count ]. bag sortedElements
| N M random bag | N := 10. M := 1e6. random := Random new. bag := Bag new. M timesRepeat: [ | pairs count | pairs := (random next: N) with: (random next: N) collect: [:a :b | {a. b}]. count := pairs count: [:pair | [:a :b | a > b] valueWithArguments: pair]. bag add: count ]. bag sortedElements
state = "sleep" while True: x = input("> ") if x == "hi": print("zzz..." if state == "sleep" else "hello") elif x == "wake up": state = "wake up" elif x == "sleep": state = "sleep" else: print("invalid input.") 0157デフォルトの名無しさん2018/10/20(土) 18:42:18.95ID:Nttc2RvP #include <stdio.h> #include <conio.h>
int main(void) { char c,state = 0;
while(1) { c = getchar(); switch(c) { case '1': if(state == '2') { printf("hello"); } else if(state == '3') { printf("zzz..."); } break; 0158デフォルトの名無しさん2018/10/20(土) 18:43:23.41ID:Nttc2RvP case '2': state = '2'; break; case '3': state = '3'; break; default: break; 0159デフォルトの名無しさん2018/10/20(土) 18:43:31.11ID:Nttc2RvP } } return 0; }