結果
問題 | No.559 swapAB列 |
ユーザー |
|
提出日時 | 2020-04-02 18:53:46 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 403 bytes |
コンパイル時間 | 112 ms |
コンパイル使用メモリ | 23,168 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-28 15:16:08 |
合計ジャッジ時間 | 632 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 7 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:5:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 5 | scanf("%s",AB); | ~~~~~^~~~~~~~~
ソースコード
#include <cstdio>#include <cstring>int main(){char AB[13];scanf("%s",AB);int cnt=0,flag;do{flag=0;for(int i=1;i<strlen(AB);i++){if(AB[i-1]>AB[i]){char tmp=AB[i];AB[i]=AB[i-1];AB[i-1]=tmp;cnt++;flag=1;}}}while(flag);printf("%d\n",cnt);return 0;}