結果
| 問題 | No.49 算数の宿題 |
| コンテスト | |
| ユーザー |
togari_takamoto
|
| 提出日時 | 2016-02-28 13:04:13 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 5,000 ms |
| コード長 | 244 bytes |
| 記録 | |
| コンパイル時間 | 931 ms |
| コンパイル使用メモリ | 173,060 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-05-29 04:37:53 |
| 合計ジャッジ時間 | 1,695 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:3:26: warning: 'char* gets(char*)' is deprecated [-Wdeprecated-declarations]
3 | char s[102]; gets(s);
| ~~~~^~~
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/cstdio:47,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/ext/string_conversions.h:47,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/basic_string.h:4444,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/string:56,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bitset:54,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/x86_64-pc-linux-gnu/bits/stdc++.h:54,
from main.cpp:1:
/usr/include/stdio.h:667:14: note: declared here
667 | extern char *gets (char *__s) __wur __attribute_deprecated__;
| ^~~~
/usr/bin/ld: /tmp/cct8csDe.o: in function `main':
main.cpp:(.text.startup+0x14): 警告: the `gets' function is dangerous and should not be used.
ソースコード
#include <bits/stdc++.h>
int main() {
char s[102]; gets(s);
char* i;
int sum = strtol(s, &i, 10);
while (*i!='\0') {
sum = *i == '*' ? sum + strtol(i + 1, &i, 10)
: sum * strtol(i + 1, &i, 10);
}
printf("%d\n", sum);
}
togari_takamoto