結果
問題 |
No.428 小数から逃げる夢
|
ユーザー |
|
提出日時 | 2016-10-27 16:48:39 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,455 bytes |
コンパイル時間 | 627 ms |
コンパイル使用メモリ | 68,080 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-24 04:55:31 |
合計ジャッジ時間 | 2,677 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 7 WA * 93 |
ソースコード
#include <iostream> using namespace std; void pluplus(int posi,string &result_list,char sc){ if(result_list[posi] == *" "){ result_list[posi] = sc; }else{ result_list[posi] = *to_string((sc - '0') + (result_list[posi] - '0')).c_str(); } } void execute(string e_dream_s,int e_posi,int e_k,string &e_result_s){ int mp_result = (e_dream_s[e_posi] - '0') * e_k; int e_size = to_string(mp_result).size(); int e_size_cnt = e_size - 1; if(e_size >= 1){ pluplus(e_posi,e_result_s,to_string(mp_result)[e_size_cnt]);} if(e_size >= 2){ pluplus(e_posi-1,e_result_s,to_string(mp_result)[e_size_cnt-1]);} if(e_size >= 3){ pluplus(e_posi-2,e_result_s,to_string(mp_result)[e_size_cnt-2]);} } int main(){ long k; cin >> k; string dream_s = "0.1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991"; string result_s = ""; for(int cnt = dream_s.size()-1;cnt >= 0;cnt--){result_s+=" ";} int posi = dream_s.size()-1; for(auto s:dream_s){ if(posi >= 2) {execute(dream_s, posi, k, result_s);} posi--; } result_s.insert(2,"."); if(result_s[1] == *" "){result_s.insert(1,"0");} for(size_t c = result_s.find_first_of(" "); c != string::npos; c = result_s.find_first_of(" ")){result_s.erase(c,1);} cout << result_s << endl; }