結果
| 問題 | 
                            No.2038 Strange Arrange
                             | 
                    
| コンテスト | |
| ユーザー | 
                             tnakao0123
                         | 
                    
| 提出日時 | 2022-08-17 01:12:51 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 2 ms / 2,000 ms | 
| コード長 | 730 bytes | 
| コンパイル時間 | 381 ms | 
| コンパイル使用メモリ | 41,668 KB | 
| 実行使用メモリ | 6,820 KB | 
| 最終ジャッジ日時 | 2024-10-03 20:05:05 | 
| 合計ジャッジ時間 | 1,283 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 4 | 
ソースコード
/* -*- coding: utf-8 -*-
 *
 * 2038.cc:  No.2038 Strange Arrange - yukicoder
 */
#include<cstdio>
#include<algorithm>
 
using namespace std;
/* constant */
const int MAX_N = 500;
/* typedef */
/* global variables */
int as[MAX_N + 1];
/* subroutines */
void check(int n) {
  for (int i = 1; i <= n; i++)
    for (int j = i + 1; j <= n; j++)
      if (as[i] == as[j] && i + j <= n && as[i] >= as[i + j]) {
	puts("NG"); return;
      }
  puts("OK");
}
/* main */
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1, bi = 1; i <= 9 && bi <= n; i++, bi <<= 1)
    for (int j = 1; j * bi <= n; j += 2) as[j * bi] = i;
  for (int i = 1; i <= n; i++) putchar('0' + as[i]);
  putchar('\n');
  //check(n);
  return 0;
}
            
            
            
        
            
tnakao0123