結果
問題 | No.222 引き算と足し算 |
ユーザー | 37zigen |
提出日時 | 2020-02-19 11:22:37 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 730 bytes |
コンパイル時間 | 2,012 ms |
コンパイル使用メモリ | 77,200 KB |
実行使用メモリ | 41,664 KB |
最終ジャッジ日時 | 2024-04-16 20:18:55 |
合計ジャッジ時間 | 6,931 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 121 ms
41,148 KB |
testcase_01 | AC | 118 ms
40,736 KB |
testcase_02 | AC | 122 ms
41,288 KB |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | AC | 109 ms
40,320 KB |
testcase_10 | AC | 120 ms
41,252 KB |
testcase_11 | WA | - |
testcase_12 | AC | 119 ms
41,148 KB |
testcase_13 | AC | 119 ms
41,412 KB |
testcase_14 | WA | - |
testcase_15 | AC | 105 ms
40,180 KB |
testcase_16 | AC | 114 ms
40,864 KB |
testcase_17 | WA | - |
testcase_18 | AC | 118 ms
41,120 KB |
testcase_19 | AC | 108 ms
40,064 KB |
testcase_20 | WA | - |
testcase_21 | AC | 106 ms
39,748 KB |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | AC | 121 ms
41,448 KB |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | AC | 108 ms
40,064 KB |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | AC | 107 ms
40,012 KB |
testcase_31 | WA | - |
testcase_32 | AC | 120 ms
41,376 KB |
testcase_33 | WA | - |
ソースコード
import java.util.ArrayDeque; import java.util.Arrays; import java.util.Scanner; class Main { public static void main(String[] args) throws Exception { new Main().run(); } void run() { Scanner sc=new Scanner(System.in); char[] cs=sc.next().toCharArray(); int u=0,v=0; int su=1,sv=1; int p=0; if(cs[p]=='-') { ++p; su*=-1; } while(cs[p]-'0'>=0&&9>=cs[p]-'0') { u=10*u+(int)(cs[p]-'0'); ++p; } if(cs[p]=='+')sv*=-1; ++p; if(cs[p]=='-') { ++p; sv*=-1; } while(p<cs.length&&cs[p]-'0'>=0&&9>=cs[p]-'0') { v=10*v+(int)(cs[p]-'0'); ++p; } System.out.println(su*u+sv*v); } static void tr(Object... objects) { System.out.println(Arrays.deepToString(objects)); } }