結果

問題 No.8042 本棚
コンテスト
ユーザー kotatsugame
提出日時 2019-03-18 07:51:17
言語 C++11
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 120 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 746 ms
コンパイル使用メモリ 117,676 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2026-03-16 09:51:56
合計ジャッジ時間 1,681 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:1:2: warning: '#import' is a deprecated GCC extension [-Wdeprecated]
    1 | #import<regex>
      |  ^~~~~~
main.cpp:2:34: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    2 | std::string s[51];char t[50],i,j;main(){for(;gets(t);)s[i++]=t;for(sort(s,s+i);++j<i;)puts(s[j].data());}
      |                                  ^~~~
main.cpp: In function 'int main()':
main.cpp:2:50: warning: 'char* gets(char*)' is deprecated [-Wdeprecated-declarations]
    2 | std::string s[51];char t[50],i,j;main(){for(;gets(t);)s[i++]=t;for(sort(s,s+i);++j<i;)puts(s[j].data());}
      |                                              ~~~~^~~
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/regex:42,
                 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/ccvYvQ45.o: in function `main':
main.cpp:(.text.startup+0x54): 警告: the `gets' function is dangerous and should not be used.

ソースコード

diff #
raw source code

#import<regex>
std::string s[51];char t[50],i,j;main(){for(;gets(t);)s[i++]=t;for(sort(s,s+i);++j<i;)puts(s[j].data());}
0