結果
| 問題 |
No.1988 Divisor Tiling
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-06-24 23:05:55 |
| 言語 | C++17(clang) (17.0.6 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 13 ms / 2,000 ms |
| コード長 | 897 bytes |
| コンパイル時間 | 1,717 ms |
| コンパイル使用メモリ | 141,904 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-08 18:46:53 |
| 合計ジャッジ時間 | 3,244 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 32 |
ソースコード
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
int main() {
int n, h;
cin >> n >> h;
int w = n / h;
vector<int> ans;
for(int i = 2; i <= n; i++) {
if(n % i == 0) {
for(int j = 0; j < n / i; j++) {
ans.push_back(n / i);
}
}
}
// for(auto p : ans) {
// cout << p << " ";
// }
// cout << endl;
if(h < w) {
for(int i = 0; i < h; i++) {
for(int j = 0; j < w; j++) {
cout << ans[i * w + j] << " ";
}
cout << endl;
}
} else {
for(int i = 0; i < h; i++) {
for(int j = 0; j < w; j++) {
cout << ans[i + j * h] << " ";
}
cout << endl;
}
}
return 0;
}