結果

問題 No.313 π
ユーザー 0w10w1
提出日時 2016-11-27 21:20:55
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 264 ms / 5,000 ms
コード長 1,078 bytes
コンパイル時間 1,617 ms
コンパイル使用メモリ 168,080 KB
実行使用メモリ 43,920 KB
最終ジャッジ日時 2023-08-18 08:32:40
合計ジャッジ時間 11,552 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 251 ms
43,680 KB
testcase_01 AC 252 ms
43,792 KB
testcase_02 AC 257 ms
43,720 KB
testcase_03 AC 238 ms
43,792 KB
testcase_04 AC 238 ms
43,720 KB
testcase_05 AC 249 ms
43,920 KB
testcase_06 AC 241 ms
43,852 KB
testcase_07 AC 233 ms
43,792 KB
testcase_08 AC 237 ms
43,660 KB
testcase_09 AC 242 ms
43,792 KB
testcase_10 AC 237 ms
43,720 KB
testcase_11 AC 240 ms
43,788 KB
testcase_12 AC 254 ms
43,652 KB
testcase_13 AC 243 ms
43,724 KB
testcase_14 AC 246 ms
43,800 KB
testcase_15 AC 253 ms
43,724 KB
testcase_16 AC 247 ms
43,664 KB
testcase_17 AC 243 ms
43,916 KB
testcase_18 AC 253 ms
43,720 KB
testcase_19 AC 241 ms
43,728 KB
testcase_20 AC 254 ms
43,664 KB
testcase_21 AC 244 ms
43,880 KB
testcase_22 AC 264 ms
43,716 KB
testcase_23 AC 253 ms
43,704 KB
testcase_24 AC 254 ms
43,800 KB
testcase_25 AC 230 ms
43,712 KB
testcase_26 AC 232 ms
43,644 KB
testcase_27 AC 245 ms
43,720 KB
testcase_28 AC 251 ms
43,912 KB
testcase_29 AC 259 ms
43,652 KB
testcase_30 AC 252 ms
43,720 KB
testcase_31 AC 260 ms
43,796 KB
testcase_32 AC 240 ms
43,664 KB
testcase_33 AC 243 ms
43,652 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

signed main(){
  vector< int > np( ( int ) 1e7 );
  vector< int > pt;
  for( int i = 2; pt.size() < ( int ) 2e5 + 1; ++i )
    if( not np[ i ] ){
      if( i > 9 )
        pt.emplace_back( i );
      for( int j = i + i; j < ( int ) 1e7; j += i )
        np[ j ] = 1;
    }

  /*
  string pi; cin >> pi;
  pi[ 0 ] = '3';
  ll hoge = 0LL;
  for( int i = 0, p = 0; i < pi.size(); ++i ){
    if( pi[ i ] == '.' ) continue;
    hoge += 1LL * pt[ p ] * ( pi[ i ] - '0' );
    ++p;
  }
  cout << hoge << endl;
  assert( hoge == 1187844913846LL );
  */

  const ll hoge = 1187894336729LL;
  
  string S; cin >> S;
  ll foo = 0LL;
  for( int i = 0, p = 0; i < S.size(); ++i ){
    if( S[ i ] == '.' ) continue;
    foo += 1LL * pt[ p ] * ( S[ i ] - '0' );
    ++p;
  }
  ll diff = foo - hoge;
  for( int i = 0; i < pt.size(); ++i )
    if( abs( diff ) % pt[ i ] == 0 ){
      int x = i > 0 ? i + 1 : i;
      cout << S[ x ] << " " << ( char ) ( S[ x ] - diff / pt[ i ] ) << endl;
      exit( 0 );
    }

  return 0;
}
0