結果
| 問題 |
No.428 小数から逃げる夢
|
| コンテスト | |
| ユーザー |
crazybbb3
|
| 提出日時 | 2016-11-27 13:09:36 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 91 ms / 1,000 ms |
| コード長 | 2,247 bytes |
| コンパイル時間 | 2,627 ms |
| コンパイル使用メモリ | 82,080 KB |
| 実行使用メモリ | 38,572 KB |
| 最終ジャッジ日時 | 2024-11-27 12:09:35 |
| 合計ジャッジ時間 | 13,974 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 100 |
ソースコード
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class Main {
static BufferedReader in;
static PrintWriter out;
static StringTokenizer tok;
void solve() throws IOException {
int[] d = "1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991".chars().map(c -> c - '0').toArray();
int n = ni();
int[] ans = new int[192];
for (int i = 189; i >= 0; i--) {
ans[i + 2] += d[i] * n;
if (ans[i + 2] >= 10) {
ans[i + 1] += ans[i + 2] / 10;
ans[i + 2] %= 10;
}
}
int x = ans[0] * 10 + ans[1];
out.print(x + ".");
for (int i = 2; i < 192; i++) {
out.print(ans[i]);
}
}
String ns() throws IOException {
while (!tok.hasMoreTokens()) {
tok = new StringTokenizer(in.readLine(), " ");
}
return tok.nextToken();
}
int ni() throws IOException {
return Integer.parseInt(ns());
}
long nl() throws IOException {
return Long.parseLong(ns());
}
double nd() throws IOException {
return Double.parseDouble(ns());
}
String[] nsa(int n) throws IOException {
String[] res = new String[n];
for (int i = 0; i < n; i++) {
res[i] = ns();
}
return res;
}
int[] nia(int n) throws IOException {
int[] res = new int[n];
for (int i = 0; i < n; i++) {
res[i] = ni();
}
return res;
}
long[] nla(int n) throws IOException {
long[] res = new long[n];
for (int i = 0; i < n; i++) {
res[i] = nl();
}
return res;
}
public static void main(String[] args) throws IOException {
in = new BufferedReader(new InputStreamReader(System.in));
out = new PrintWriter(System.out);
tok = new StringTokenizer("");
Main main = new Main();
main.solve();
out.close();
}
}
crazybbb3