結果

問題 No.796 well known
ユーザー TAKEKATSUTAKEKATSU
提出日時 2019-03-18 13:59:41
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,260 bytes
コンパイル時間 1,558 ms
コンパイル使用メモリ 168,900 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-25 10:07:20
合計ジャッジ時間 4,406 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘long long int gcd(long long int, long long int)’ 内:
main.cpp:30:11: 警告: 制御が非 void 関数の終りに到達しました [-Wreturn-type]
   30 |   else gcd(b, a%b);
      |        ~~~^~~~~~~~

ソースコード

diff #

#include "bits/stdc++.h"

using namespace std;

#define ll long long
#define vi  vector<int>
#define vvi vector<vi>
#define pi  pair<int,int>
#define mp  make_pair
#define pb  push_back
#define MOD 1e9 + 7
#define PAI  3.1415
#define all(x) (x).begin(),(x).end()
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
#define pr(x) cout << x << endl
#define Endl endl
#define rep(i,n) for(int i = 0 ; i < n; i++)

const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
const int ddx[8] = {-1,0,1,-1,1,-1,0,1};
const int ddy[8] = {-1,-1,-1,0,0,1,1,1};
const int inf = 99999999;
const ll linf = 1LL << 62;

ll gcd(ll a,ll b){
  if(a < b)swap(a , b);
  if(a % b == 0) return b;
  else gcd(b, a%b);
}

ll lcm(ll a,ll b){
  if(a < b)swap(a , b);
  return (a/gcd(a , b))*b;
}

int main(){

  int n; cin >> n;
  
  vi ans;

  if(n % 3 == 1){
    for(int i = 1; i <= n; i++)
      ans.pb(i);
  }
  else if (n % 3 == 2){
    for(int i = 1; i < n; i++)
      ans.pb(i);
    ans.pb(n + 1);
  }
  else{
    for(int i = 3; i < n + 2; i++)
      ans.pb(i);
    ans.pb(n + 3);
  }
    

  //ll sum = 0;
  for(int i = 0; i < ans.size(); i++)
  {
    //sum += ans[i];
    if(i != 0)cout << ' ';
    cout << ans[i];
  }
  cout << endl;
  //pr(sum);

  return 0;
}
0