結果
| 問題 |
No.3245 Payment with 8-rep Currency
|
| コンテスト | |
| ユーザー |
pengin_2000
|
| 提出日時 | 2025-08-23 00:01:19 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 769 bytes |
| コンパイル時間 | 1,051 ms |
| コンパイル使用メモリ | 27,472 KB |
| 実行使用メモリ | 7,716 KB |
| 最終ジャッジ日時 | 2025-08-23 00:01:31 |
| 合計ジャッジ時間 | 5,856 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 1 |
| other | AC * 25 WA * 5 |
コンパイルメッセージ
main.c: In function ‘solve’:
main.c:5:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
5 | scanf("%lld", &n);
| ^~~~~~~~~~~~~~~~~
main.c: In function ‘main’:
main.c:46:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
46 | scanf("%d", &t);
| ^~~~~~~~~~~~~~~
ソースコード
#include<stdio.h>
void solve()
{
long long int n;
scanf("%lld", &n);
if (n % 8 > 0)
{
printf("-1\n");
return;
}
n /= 8;
long long int a, b, c, d, s;
if (n < 1665)
{
for (d = 0; 1111 * d <= n; d++)
{
for (c = 0; 1111 * d + 111 * c <= n; c++)
{
for (b = 0; 1111 * d + 111 * c + 11 * b <= n; b++)
{
a = n - 1111 * d - 111 * c - 11 * b;
s = a + b + c + d;
if (2 * a < s && 2 * b < s && 2 * c < s && 2 * d < s)
{
printf("%lld %lld %lld %lld\n", a, b, c, d);
return;
}
}
}
}
}
else
{
d = 0;
c = 13;
n -= 111 * 13;
b = n / 12;
a = n - 11 * b;
printf("%lld %lld %lld %lld\n", a, b, c, d);
}
return;
}
int main()
{
int t;
scanf("%d", &t);
for (; t > 0; t--)
solve();
return 0;
}
pengin_2000