結果
問題 | No.193 筒の数式 |
ユーザー | naimonon77 |
提出日時 | 2015-12-03 16:08:50 |
言語 | C++11 (gcc 11.4.0) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 1,495 bytes |
コンパイル時間 | 515 ms |
コンパイル使用メモリ | 61,568 KB |
実行使用メモリ | 4,352 KB |
最終ジャッジ日時 | 2023-10-12 09:30:42 |
合計ジャッジ時間 | 1,750 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,352 KB |
testcase_01 | AC | 1 ms
4,348 KB |
testcase_02 | AC | 1 ms
4,348 KB |
testcase_03 | AC | 1 ms
4,352 KB |
testcase_04 | AC | 2 ms
4,348 KB |
testcase_05 | AC | 2 ms
4,348 KB |
testcase_06 | AC | 1 ms
4,352 KB |
testcase_07 | AC | 1 ms
4,348 KB |
testcase_08 | AC | 2 ms
4,348 KB |
testcase_09 | AC | 2 ms
4,348 KB |
testcase_10 | WA | - |
testcase_11 | AC | 2 ms
4,348 KB |
testcase_12 | AC | 1 ms
4,348 KB |
testcase_13 | AC | 1 ms
4,348 KB |
testcase_14 | AC | 2 ms
4,348 KB |
testcase_15 | AC | 2 ms
4,352 KB |
testcase_16 | AC | 1 ms
4,352 KB |
testcase_17 | AC | 2 ms
4,348 KB |
testcase_18 | AC | 1 ms
4,352 KB |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:76:11: warning: ‘mem1’ may be used uninitialized in this function [-Wmaybe-uninitialized] s[i+n/2] = mem1; ~~~~~~~~~^~~~~~
ソースコード
#include <iostream> #include <cstring> #include <algorithm> #include <limits.h> #define REP(i,a,b) for(i=a;i<b;i++) #define rep(i,n) REP(i,0,n) using namespace std; typedef long long ll; typedef unsigned long long ull; typedef long double ld; /* ここからが本編 */ /* */ /* 入力開始! */ /* 入力終了! */ int n; void suuzi(char s[],int i,int& j) { for(; j < n/2; j++) { if(s[i+j] < '0' || '9' < s[i+j]) break; } } int main(void) { int i,j,k,l; char s[25]; int mem1; int rep = INT_MIN; cin >> s; strcat(s,s); n = strlen(s); for(i = 0; i < n/2; i++) { int m = 1; for(j = 0; j < n/2; j++) { if(s[i+j] == '+' || s[i+j] == '-') { if(m == 1) break; else m = 1; } if('0' <= s[i+j] && s[i+j] <= '9') m = 0; } /* cout << endl; cout << "i = " << i << endl; cout << "j = " << j << endl; */ if(m == 1) continue; if(j == n/2) { mem1 = s[i+n/2]; s[i+n/2] = 0; /* for(j=0;j<n/2;j++) { cout << s[i+j]; } cout << endl; */ int ans; j = 0; ans = atoi(s+i+j); suuzi(s,i,j); /* cout << "ans = " << ans << endl; cout << "j = " << j << endl; */ // s[j] = '+' or '-' while(j < n/2) { ans += atoi(s+i+j); // cout << "atoi(s+i+j) = " << atoi(s+i+j) << endl; j++; // '0' <= s[i+j] <= '9' // cout << "ans = " << ans << endl; suuzi(s,i,j); } if(ans > rep) rep = ans; } s[i+n/2] = mem1; } cout << rep << endl; return 0; }