結果

問題 No.2297 Best Grouping
ユーザー ARCANA
提出日時 2023-07-24 21:25:55
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 348 bytes
コンパイル時間 555 ms
コンパイル使用メモリ 67,840 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-01 16:26:14
合計ジャッジ時間 1,358 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 20
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:25:11: warning: 'ans' may be used uninitialized [-Wmaybe-uninitialized]
   25 |   cout << ans << endl;
      |           ^~~
main.cpp:14:7: note: 'ans' was declared here
   14 |   int ans;
      |       ^~~

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
  // input
  int N;
  cin >> N;
  int count =0;
  count = N / 3;
  int nokori = N % 3;
  int ans;
  if(nokori == 0){
    ans = 0;
  } else if(nokori == 1){
    ans = 2;
  } else if(nokori == 2){
      ans = 1;
  }



  cout << ans << endl;
  // output 
}
0