結果
| 問題 |
No.428 小数から逃げる夢
|
| コンテスト | |
| ユーザー |
peroon
|
| 提出日時 | 2019-06-03 21:50:40 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,668 bytes |
| コンパイル時間 | 1,592 ms |
| コンパイル使用メモリ | 172,736 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-09-17 20:35:35 |
| 合計ジャッジ時間 | 3,916 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 89 WA * 11 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define br() p("")
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("Yes")
#define p_no() p("No")
const ll mod = 1e9 + 7;
const ll inf = 1e18;
template < typename T >
void vprint(T &V){
for(auto v : V){
cout << v << " ";
}
cout << endl;
}
ll ctoi(char c){
return c - '0';
}
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
string s = "1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991";
//string s = "12345";
ll N; cin >> N;
ll L = s.size();
vector<ll> A;
ll kuri = 0; // 繰り上がり
for(int i=L-1; i>=0; i--){
char c = s[i];
ll v = ctoi(c);
ll a = ((v * N) + kuri) % 10;
A.push_back(a);
kuri = ((v*N)+kuri) / 10;
}
if(kuri) A.push_back(kuri);
stringstream ss;
for(ll a : A){
ss << a;
}
s = ss.str();
reverse(ALL(s));
if(N<=8){
cout << "0." << s << endl;
}
else if(N<=81){
cout << s[0] << '.' << s.substr(1) << endl;
}
else{
cout << s.substr(0, 2) << '.' << s.substr(2) << endl;
}
return 0;
}
peroon