結果

問題 No.313 π
ユーザー 0w10w1
提出日時 2016-11-27 21:19:50
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,106 bytes
コンパイル時間 1,375 ms
コンパイル使用メモリ 169,668 KB
実行使用メモリ 43,944 KB
最終ジャッジ日時 2024-05-05 14:20:52
合計ジャッジ時間 10,777 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
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 -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
権限があれば一括ダウンロードができます

ソースコード

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 << diff << endl;
      cout << S[ x ] << " " << ( char ) ( S[ x ] - diff / pt[ i ] ) << endl;
      exit( 0 );
    }

  return 0;
}
0