結果

問題 No.851 テストケース
ユーザー LayCurseLayCurse
提出日時 2019-07-26 21:30:27
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 3,153 ms
コード長 1,274 bytes
コンパイル時間 1,281 ms
コンパイル使用メモリ 146,184 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-15 00:37:51
合計ジャッジ時間 2,366 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 1 ms
4,380 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:38:16: warning: ‘char* gets(char*)’ is deprecated [-Wdeprecated-declarations]
     gets(buf[i]);
                ^
In file included from /usr/include/c++/8/cstdio:42,
                 from /usr/include/c++/8/x86_64-redhat-linux/bits/stdc++.h:46,
                 from main.cpp:1:
/usr/include/stdio.h:583:14: note: declared here
 extern char *gets (char *__s) __wur __attribute_deprecated__;
              ^~~~
main.cpp:38:16: warning: ‘char* gets(char*)’ is deprecated [-Wdeprecated-declarations]
     gets(buf[i]);
                ^
In file included from /usr/include/c++/8/cstdio:42,
                 from /usr/include/c++/8/x86_64-redhat-linux/bits/stdc++.h:46,
                 from main.cpp:1:
/usr/include/stdio.h:583:14: note: declared here
 extern char *gets (char *__s) __wur __attribute_deprecated__;
              ^~~~
/tmp/ccpIESeM.o: In function `main':
main.cpp:(.text.startup+0x7): warning: the `gets' function is dangerous and should not be used.

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(long long x){
  char f[20];
  int m=0, s=0;
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
inline void wt_L(const char c[]){
  int i=0;
  for(i=0;c[i]!='\0';i++){
    putchar_unlocked(c[i]);
  }
}
long long A[3];
char buf[4][1000];
int main(){
  int i;
  for(i=0;i<4;i++){
    gets(buf[i]);
  }
  if(sscanf(buf[1], "%lld%lld%lld", A, A+1, A+2) == 3){
    wt_L("\"assert\"");
    wt_L('\n');
    return 0;
  }
  for(i=0;i<3;i++){
    sscanf(buf[i+1], "%lld", A+i);
  }
  sort(A,A+3);
  if(A[0]==A[1] || A[1]==A[2]){
    wt_L(A[0]+A[1]);
    wt_L('\n');
  }
  else{
    wt_L(A[0]+A[2]);
    wt_L('\n');
  }
  return 0;
}
// cLay varsion 20190721-1

// --- original code ---
// ll A[3];
// char buf[4][1000];
// {
//   int i;
//   
//   rep(i,4) gets(buf[i]);
//   if(sscanf(buf[1], "%lld%lld%lld", A, A+1, A+2) == 3){
//     wt("\"assert\"");
//     return 0;
//   }
// 
//   rep(i,3) sscanf(buf[i+1], "%lld", A+i);
// 
//   sort(A,A+3);
//   if(A[0]==A[1] || A[1]==A[2]) wt(A[0]+A[1]); else wt(A[0]+A[2]);
// }
0