結果
問題 |
No.428 小数から逃げる夢
|
ユーザー |
![]() |
提出日時 | 2016-10-02 22:59:41 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 1,324 bytes |
コンパイル時間 | 618 ms |
コンパイル使用メモリ | 88,196 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-21 13:26:30 |
合計ジャッジ時間 | 2,750 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 100 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:35:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 35 | scanf("%d", &n); | ~~~~~^~~~~~~~~~
ソースコード
#include <iostream> #include <cstdio> #include <vector> #include <cmath> #include <cstring> #include <numeric> #include <algorithm> #include <functional> #include <array> #include <map> #include <queue> #include <limits.h> #include <set> #include <bitset> #include <stack> #include <cstdlib> #include <complex> #include <unordered_map> #define REP(i,n) for(int i = 0; n > i; i++) #define MODU 33 #define Range(x,a,b) ((a) <= (x) && (x) <= (b)) #define POWT(x) ((x)*(x)) #define ALL(x) (x).begin(), (x).end() #define C_D(c) ((c) - '0') #define D_C(d) ((d) + '0') using namespace std; typedef vector<int> Ivec; typedef pair<int, int> pii; typedef long long int ll; int main() { int n; char d[1000] = { "1998979695949392919099888786858483828180897877767574737271707968676665646362616069585756555453525150594847464544434241404938373635343332313039282726252423222120291817161514131211101987654321" }; int an[1000] = {}; scanf("%d", &n); REP(i, 200) { if (!d[i])continue; an[i] += (C_D(d[i]) * n); } REP(i, 200) { if (an[i] >= 10) { an[i + 1] += an[i] / 10; an[i] = an[i] % 10; } } bool f = 0; for (int i = 200; 189 < i; i--) { f = an[i]; if (f) { printf("%d", an[i]); } } if (!f)printf("0"); printf("."); for(int i = 189; 0 <= i; i--) { printf("%d", an[i]); } printf("\n"); return 0; }