結果
問題 | No.2143 Only One Bracket |
ユーザー |
![]() |
提出日時 | 2024-11-13 12:02:45 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 639 bytes |
コンパイル時間 | 2,176 ms |
コンパイル使用メモリ | 191,716 KB |
最終ジャッジ日時 | 2025-02-25 04:03:29 |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 7 |
ソースコード
#include <bits/stdc++.h> //#include <atcoder/modint> using namespace std; //using namespace atcoder; using ll = long long; //using mint = modint998244353; int main(){ cin.tie(nullptr); ios_base::sync_with_stdio(false); /* 1,4,9,... (0,+1),(-1,+2),(-2,+3),... のようにしていくと(*,+x)の後には(-x,*)を付ける必要がある。 */ int N; cin >> N; for (int i=1; i<=N-1; i++){ for (int j=0; j<i-1; j++) cout << ')'; for (int j=0; j<i; j++) cout << '('; cout << endl; } for (int i=0; i<N-1; i++) cout << ')'; cout << endl; return 0; }