ログインしてください。
提出 #74732787
ソースコード 拡げる
#include <iostream>
void HelloWorld(int n) {
char x[n] = {'L'};
for (int i = 1; i < n-2; ++i) {
x[i] = 'o';
//std::cout << "[" << i << "] " << "Hello World!" << std::endl;
}
x[n-2] = 'n';
x[n-1] = 'g';
for (int i = 0; i < n; ++i) {
std::cout << x[i] ;
}
}
int main() {
int n = 0;
std::cin >> n;
HelloWorld(n+3);
return 0;
}
提出情報
| 提出日時 | |
|---|---|
| 問題 | A - Long Loong |
| ユーザ | ryottka |
| 言語 | C++23 (GCC 15.2.0) |
| 得点 | 100 |
| コード長 | 419 Byte |
| 結果 | AC |
| 実行時間 | 1 ms |
| メモリ | 3652 KiB |
コンパイルエラー
In function 'HelloWorld',
inlined from 'main' at ./Main.cpp:20:15:
./Main.cpp:9:12: warning: writing 2 bytes into a region of size 0 [-Wstringop-overflow=]
9 | x[n-2] = 'n';
| ^
./Main.cpp:4:10: note: at offset [-2147483647, -1] into destination object 'x' of size [0, 2147483647]
4 | char x[n] = {'L'};
| ^
ジャッジ結果
| セット名 | Sample | All | ||||
|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 100 / 100 | ||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| Sample | example_00.txt, example_01.txt |
| All | example_00.txt, example_01.txt, hand_00.txt, hand_01.txt, hand_02.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| example_00.txt | AC | 1 ms | 3496 KiB |
| example_01.txt | AC | 1 ms | 3520 KiB |
| hand_00.txt | AC | 1 ms | 3652 KiB |
| hand_01.txt | AC | 1 ms | 3492 KiB |
| hand_02.txt | AC | 1 ms | 3484 KiB |
| random_00.txt | AC | 1 ms | 3460 KiB |
| random_01.txt | AC | 1 ms | 3496 KiB |
| random_02.txt | AC | 1 ms | 3516 KiB |
| random_03.txt | AC | 1 ms | 3484 KiB |
| random_04.txt | AC | 1 ms | 3516 KiB |