結果

問題 No.313 π
ユーザー yishibashi
提出日時 2016-06-22 19:05:25
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 652 bytes
コンパイル時間 665 ms
コンパイル使用メモリ 58,328 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-11 19:23:10
合計ジャッジ時間 3,321 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 2
other WA * 32
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:30:23: warning: ‘t’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   30 |   cout << f << " " << t << endl;
      |                       ^
main.cpp:30:16: warning: ‘f’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   30 |   cout << f << " " << t << endl;
      |                ^~~

ソースコード

diff #

#include <iostream>
#include <string>
#include <sstream>

using namespace std;

int nums[10] = {20104,20063,19892,20011,19874,20199,19898,20163,19956,19841};

int main()
{
  string ispi; cin >> ispi;
  int count[10] = {0}; count[3] += 1;

  stringstream ss;
  for (int i = 2; i < ispi.size(); i++) {
    string tmp;
    tmp = ispi[i];
    int n;
    ss << tmp;
    ss >> n;
    count[n] += 1;
    ss.clear(); // 状態をクリア.
    ss.str(""); // 文字列をクリア.
  }
  int f,t;
  for(int i = 0; i < 10; i++){
    if(count[i] < nums[i]) f = count[i];
    if(count[i] > nums[i]) t = nums[i];
  }
  cout << f << " " << t << endl;
  return 0;
}
0