結果

問題 No.1658 Product / Sum
ユーザー tnakao0123tnakao0123
提出日時 2021-08-28 17:18:45
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 7 ms / 2,000 ms
コード長 858 bytes
コンパイル時間 904 ms
コンパイル使用メモリ 92,508 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-05-01 16:01:35
合計ジャッジ時間 2,685 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 1 ms
6,940 KB
testcase_05 AC 7 ms
6,940 KB
testcase_06 AC 7 ms
6,940 KB
testcase_07 AC 2 ms
6,944 KB
testcase_08 AC 6 ms
6,940 KB
testcase_09 AC 3 ms
6,940 KB
testcase_10 AC 3 ms
6,940 KB
testcase_11 AC 3 ms
6,940 KB
testcase_12 AC 2 ms
6,940 KB
testcase_13 AC 3 ms
6,940 KB
testcase_14 AC 6 ms
6,940 KB
testcase_15 AC 3 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/* -*- coding: utf-8 -*-
 *
 * 1658.cc:  No.1658 Product / Sum - 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 */

/* typedef */

/* global variables */

/* subroutines */

/* main */

int main() {
  // let a1=x,a2=y,a3..an=1
  // -> a1*..*an/(a1+..+an)=xy/(x+y+n-2)=k -> xy=k(x+y+n-2)
  // -> xy-k(x+y)=k(n-2) -> xy-k(x+y)+k^2=k^2+k(n-2)
  // -> (x-k)(y-k)=k(k+n-2)
  // -> x=2k, y=2k+n-2

  int n, k;
  scanf("%d%d", &n, &k);

  printf("%d %d", 2 * k, 2 * k + n - 2);
  for (int i = 2; i < n; i++) printf(" 1");
  putchar('\n');
  return 0;
}
0