結果

問題 No.851 テストケース
ユーザー MarcusAureliusAntoninusMarcusAureliusAntoninus
提出日時 2019-07-26 21:29:03
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 3,153 ms
コード長 441 bytes
コンパイル時間 1,908 ms
コンパイル使用メモリ 196,228 KB
最終ジャッジ日時 2025-01-07 07:41:11
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:10:29: warning: format ‘%lld’ expects argument of type ‘long long int*’, but argument 3 has type ‘int64_t*’ {aka ‘long int*’} [-Wformat=]
   10 |                 scanf("%c%lld", &blank, num + i);
      |                          ~~~^           ~~~~~~~
      |                             |               |
      |                             long long int*  int64_t* {aka long int*}
      |                          %ld
main.cpp:20:28: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 2 has type ‘long int’ [-Wformat=]
   20 |                 printf("%lld\n", sum.top());
      |                         ~~~^     ~~~~~~~~~
      |                            |            |
      |                            |            long int
      |                            long long int
      |                         %ld
main.cpp:6:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |         scanf("%d", &N);
      |         ~~~~~^~~~~~~~~~
main.cpp:10:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 |                 scanf("%c%lld", &blank, num + i);
      |                 ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <bits/stdc++.h>

int main()
{
	int N;
	scanf("%d", &N);
	char blank;
	int64_t num[3];
	for (int i{}; i < 3; i++)
		scanf("%c%lld", &blank, num + i);
	if (blank == ' ') puts("\"assert\"");
	else
	{
		std::priority_queue<int64_t> sum;
		for (int i{}; i < 3; i++)
			for (int j{}; j < i; j++)
				sum.push(num[i] + num[j]);
		int64_t tmp{sum.top()};
		while (sum.top() == tmp) sum.pop();
		printf("%lld\n", sum.top());
	}

	return 0;
}
0