結果
問題 | No.688 E869120 and Constructing Array 2 |
ユーザー |
![]() |
提出日時 | 2018-05-19 18:45:25 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 969 bytes |
コンパイル時間 | 1,254 ms |
コンパイル使用メモリ | 85,028 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-07 13:59:55 |
合計ジャッジ時間 | 2,849 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 3 |
other | AC * 1 WA * 9 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:41:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 41 | scanf("%d", &k); | ~~~~~^~~~~~~~~~
ソースコード
/* -*- coding: utf-8 -*- * * 688.cc: No.688 E869120 and Constructing Array 2 - yukicoder */ #include<cstdio> #include<cstdlib> #include<cstring> #include<cmath> #include<iostream> #include<string> #include<vector> #include<map> #include<set> #include<stack> #include<list> #include<queue> #include<deque> #include<algorithm> #include<numeric> #include<utility> #include<complex> #include<functional> using namespace std; /* constant */ const int MAX_N = 30; /* typedef */ /* global variables */ /* subroutines */ /* main */ int main() { int k; scanf("%d", &k); int n, m; bool found = false; for (n = 2; n <= MAX_N; n++) { for (m = 2; m <= n; m++) { int d = m * (m - 1) / 2 * (1 << (n - m)); if (d == k) { found = true; break; } } if (found) break; } //printf("n=%d, m=%d\n", n, m); for (int i = 0; i < n; i++) { if (i) putchar(' '); printf("%d", i < m ? 1 : 0); } putchar('\n'); return 0; }