結果

問題 No.2609 Decreasing GCDs
ユーザー tanaka255tanaka255
提出日時 2024-01-19 21:38:53
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 515 bytes
コンパイル時間 1,956 ms
コンパイル使用メモリ 203,184 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-01-19 21:39:00
合計ジャッジ時間 3,005 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 2 ms
6,676 KB
testcase_03 AC 2 ms
6,676 KB
testcase_04 AC 2 ms
6,676 KB
testcase_05 AC 1 ms
6,676 KB
testcase_06 AC 1 ms
6,676 KB
testcase_07 AC 2 ms
6,676 KB
testcase_08 AC 1 ms
6,676 KB
testcase_09 AC 1 ms
6,676 KB
testcase_10 AC 2 ms
6,676 KB
testcase_11 AC 1 ms
6,676 KB
testcase_12 AC 2 ms
6,676 KB
testcase_13 AC 1 ms
6,676 KB
testcase_14 AC 1 ms
6,676 KB
testcase_15 AC 1 ms
6,676 KB
testcase_16 AC 1 ms
6,676 KB
testcase_17 AC 2 ms
6,676 KB
testcase_18 AC 2 ms
6,676 KB
testcase_19 AC 2 ms
6,676 KB
testcase_20 AC 2 ms
6,676 KB
testcase_21 AC 2 ms
6,676 KB
testcase_22 AC 2 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
int N;
bool ok(vector<int>a){
  for(int i=0;i<N-1;++i){
    if(a[i]<a[i+1])continue;
    return 0;
  }
  for(int i=0;i<N-2;++i){
    if(gcd(a[i],a[i+1])>gcd(a[i+1],a[i+2]))continue;
    return 0;
  }
  return 1;
}
int main(){
  cin>>N;
  vector<int>ans(N,0);
  ans[0]=1<<(N-1);
  for(int i=1;i<N;++i){
    int a=1<<(N-1-i);
    int mul=ans[i-1]/a;
    if(mul%2==0)++mul;
    ans[i]=a*mul;
  }
  for(int i=0;i<N;++i)cout<<ans[i]<<" \n"[i+1==N];
  //cout<<ok(ans)<<endl;
}
0