結果
問題 |
No.2870 Dice Making
|
ユーザー |
![]() |
提出日時 | 2024-09-09 22:58:49 |
言語 | C (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 695 bytes |
コンパイル時間 | 1,144 ms |
コンパイル使用メモリ | 30,080 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-09 22:58:53 |
合計ジャッジ時間 | 2,400 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 13 |
ソースコード
#pragma GCC diagnostic ignored "-Wunused-result" #pragma GCC optimize "Ofast" #include <stdint.h> #include <stdio.h> #include <string.h> uint8_t c, ostr[200], *optr = ostr; int main() { uint8_t istr[10], *iptr = istr, n = 0, k = 0; fread(istr, 1, 10, stdin); while ((c = *iptr++) >= '0') n = n * 10 + (c - '0'); while ((c = *iptr++) >= '0') k = k * 10 + (c - '0'); if (n % k == 0) { int8_t t = n / k, r = n - t; while (--t >= 0) { memcpy(optr, "1 ", 2); optr += 2; } while (--r >= 0) { memcpy(optr, "2 ", 2); optr += 2; } } else { memcpy(optr, "-1", 2); optr += 2; } fwrite(ostr, 1, optr - ostr, stdout); return 0; }