結果
| 問題 |
No.457 (^^*)
|
| コンテスト | |
| ユーザー |
bal4u
|
| 提出日時 | 2019-06-26 08:42:49 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| コード長 | 781 bytes |
| コンパイル時間 | 759 ms |
| コンパイル使用メモリ | 28,416 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-24 01:16:06 |
| 合計ジャッジ時間 | 1,523 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 |
コンパイルメッセージ
main.c: In function 'ins':
main.c:7:14: warning: implicit declaration of function 'getchar_unlocked' [-Wimplicit-function-declaration]
7 | #define gc() getchar_unlocked()
| ^~~~~~~~~~~~~~~~
main.c:14:17: note: in expansion of macro 'gc'
14 | do *s = gc();
| ^~
ソースコード
// yukicoder: No.457 (^^*)
// 2019.6.26 bal4u
#include <stdio.h>
#if 1
#define gc() getchar_unlocked()
#else
#define gc() getchar()
#endif
void ins(char *s) // 文字列の入力 スペース以下の文字で入力終了
{
do *s = gc();
while (*s++ > ' ');
*(s-1) = 0;
}
int L[4], R[4];
int al, ar;
char S[10005];
int main()
{
char *s;
ins(s = S);
while (*s) {
if (*s == '(') L[0]++, R[0]++;
else if (*s == '^') {
if (L[1]) L[2] += L[1], L[1] = 0;
if (L[0]) L[1] += L[0], L[0] = 0;
if (R[2]) R[3] += R[2], R[2] = 0;
if (R[1]) R[2] += R[1], R[1] = 0;
} else if (*s == '*') {
if (L[2]) L[3] += L[2], L[2] = 0;
if (R[0]) R[1] += R[0], R[0] = 0;
} else if (*s == ')') al += L[3], ar += R[3];
s++;
}
printf("%d %d\n", al, ar);
return 0;
}
bal4u