結果

問題 No.851 テストケース
ユーザー LayCurseLayCurse
提出日時 2019-07-26 21:30:27
言語 C++11
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 3,153 ms
コード長 1,274 bytes
コンパイル時間 1,282 ms
コンパイル使用メモリ 161,208 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-02 06:39:29
合計ジャッジ時間 2,020 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:38:9: warning: ‘char* gets(char*)’ is deprecated [-Wdeprecated-declarations]
   38 |     gets(buf[i]);
      |     ~~~~^~~~~~~~
In file included from /usr/include/stdio.h:894,
                 from /usr/include/c++/11/cstdio:42,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:46,
                 from main.cpp:1:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:240:1: note: declared here
  240 | gets (char *__str)
      | ^~~~
main.cpp:38:9: warning: ignoring return value of ‘char* gets(char*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   38 |     gets(buf[i]);
      |     ~~~~^~~~~~~~
In file included from /usr/include/stdio.h:894,
                 from /usr/include/c++/11/cstdio:42,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:46,
                 from main.cpp:1:
In function ‘char* gets(char*)’,
    inlined from ‘int main()’ at main.cpp:38:9:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:244:22: warning: call to ‘__gets_warn’ declared with attribute warning: please use fgets or getline instead, gets can't specify buffer size [-Wattribute-warning]
  244 |   return __gets_warn (__str);
      |          ~~~~~~~~~~~~^~~~~~~
/usr/include/x86_64-linux-gnu/bits/stdio2.h:244:22: warning: call to ‘__gets_warn’ declared with attribute warning: please use fgets or getline instead, gets can't specify buffer size [-Wattribute-warning]
/usr/include/x86_64-linux-gnu/bits/stdio2.h:244:22: warning: call to ‘__gets_warn’ declared with attribute warning: please use fgets or getline instead, gets can't specify buffer size [-Wattribute-warning]
/usr/include/x86_64-linux-gnu/bits/stdio2.h:244:22: warning: call to ‘__gets_warn’ declared with attribute warning: please use fgets or getline instead, gets can't specify buffer size [-Wattribute-warning]
/usr/bin/ld: /tmp/ccYvwadO.o: in function `main':
main.cpp:(.text.startup+0x31): 警告: 

ソースコード

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