メモ

yukicoderでゆるふわgolf

2018-07-04から1日間の記事一覧

yukicoder No.692 square1001 and Permutation 1

問題はこちら No.692 square1001 and Permutation 1 - yukicodern=1かどうか判定するだけ値を1つ見ればよいのでgets+atoiやるだけ a;main(){puts(atoi(gets(&a)-1)?"Petr":"square1001");} ……と思ったら、scanfを使う方が短くなるらしい。 未定義動作だから…

yukicoder No.683 Two Operations No.3

問題はこちら No.683 Two Operations No.3 - yukicoder逆向きに再帰で全探索すると解ける。 int f(long x,long y){ if(x==0||y==0)return 1; int flag=0; if(x%2==0)flag|=f(x/2,y-1); if(y%2==0)flag|=f(x-1,y/2); return flag; } int main(){ long x,y; sc…