結果
| 問題 |
No.689 E869120 and Constructing Array 3
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-02-23 05:26:52 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 1,000 ms |
| コード長 | 374 bytes |
| コンパイル時間 | 694 ms |
| コンパイル使用メモリ | 64,128 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-10 01:32:41 |
| 合計ジャッジ時間 | 1,954 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 13 |
コンパイルメッセージ
main.cpp:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
4 | main()
| ^~~~
ソースコード
#include<iostream>
using namespace std;
int K;
main()
{
cin>>K;
for(int i=0;i*(i-1)/2<=K;i++)
{
int t=K-i*(i-1)/2;
int s=1;
for(int j=1;j*j<=t;j++)
{
if(t%j==0)s=j;
}
if(i+s+t/s<=250)
{
cout<<i+s+t/s<<endl;
for(int j=0;j<i;j++)cout<<"1 ";
for(int j=0;j<s;j++)cout<<"3 ";
for(int j=0;j<t/s;j++)cout<<"8 ";
cout<<endl;
return 0;
}
}
}