結果

問題 No.1899 L1 Cafe
ユーザー 37zigen
提出日時 2022-01-31 06:08:43
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 73 ms / 2,000 ms
コード長 332 bytes
コンパイル時間 3,488 ms
コンパイル使用メモリ 139,204 KB
最終ジャッジ日時 2025-01-27 17:59:38
ジャッジサーバーID
(参考情報)
judge5 / judge6
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 12
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:7:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |         scanf("%lld", &T);
      |         ~~~~~^~~~~~~~~~~~
main.cpp:10:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 |                 scanf("%lld%lld%lld", &n, &a, &b);
      |                 ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include<cstdio>
#include<atcoder/all>
using namespace atcoder;
typedef long long ll;
int main() {
    ll T;
	scanf("%lld", &T);
	while (T--) {
		ll n, a, b;
		scanf("%lld%lld%lld", &n, &a, &b);
		ll ans = floor_sum(n/a, 1, -a, n-a) + floor_sum(n/b, 1, -b, n-b) - floor_sum(n/a, b, -a, n-a);
		printf("%lld\n", ans);
	}
	return 0;
}
0