結果

問題 No.2773 Wake up Record 1
コンテスト
ユーザー ななり
提出日時 2024-09-10 00:00:08
言語 C(gnu17)
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -std=gnu17 -Wno-error=implicit-function-declaration -Wno-error=implicit-int -Wno-error=incompatible-pointer-types -Wno-error=int-conversion -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
WA  
実行時間 -
コード長 1,279 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 225 ms
コンパイル使用メモリ 40,144 KB
最終ジャッジ日時 2026-02-22 12:00:20
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other WA * 3 RE * 19
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:8:15: warning: built-in function 'exp' declared as non-function [-Wbuiltin-declaration-mismatch]
    8 | const int32_t exp[] = { 100000, 10000, 1000, 100, 10, 1 };
      |               ^~~

ソースコード

diff #
raw source code

#pragma GCC diagnostic ignored "-Wunused-result"
#pragma GCC optimize "Ofast"

#include <stdint.h>
#include <stdio.h>
#include <string.h>

const int32_t exp[] = { 100000, 10000, 1000, 100, 10, 1 };
uint8_t c, ostr[1000000], *optr = ostr;
int64_t n = 0;

int main() {
  fseek(stdin, 0, 2);
  int64_t istrlen = ftell(stdin);
  uint8_t istr[istrlen], *iptr = istr;
  fseek(stdin, 0, 0);
  fread(istr, 1, istrlen, stdin);
  while ((c = *iptr++) >= '0') n = n * 10 + (c - '0');

  for (int64_t i = 2; i <= n; ) {
    if (*(int16_t*)iptr == 0x6F78) {
      iptr += 2;

      if (i == 100000) {
        memcpy(optr, "100000", 6);
        optr += 6;
      }
      if (i > 9999) {
        for (uint8_t j = 0; j < 5; ++j) *optr++ = i % exp[j] / exp[j + 1] + '0';
      }
      else if (i > 999) {
        for (uint8_t j = 1; j < 5; ++j) *optr++ = i % exp[j] / exp[j + 1] + '0';
      }
      else if (i > 99) {
        for (uint8_t j = 2; j < 5; ++j) *optr++ = i % exp[j] / exp[j + 1] + '0';
      }
      else if (i > 9) {
        for (uint8_t j = 3; j < 5; ++j) *optr++ = i % exp[j] / exp[j + 1] + '0';
      }
      else {
        *optr++ = i + '0';
      }

      *optr++ = ' ';
    }
    else {
      ++i;
      ++iptr;
    }
  }

  fwrite(ostr, 1, optr - ostr, stdout);
  return 0;
}
0