Wandbox
SettingsLog
SettingsLog
Language
GitHubLogin
Ran/Viewed Log

Viewed less than a minute ago

M8MKKnlMcjkxrtZ0

C++ gcc 12.1.0

Created at 1 minute ago

Created by anonymous

Author

anonymous

1 minute ago

Language

C++

Compiler

gcc 12.1.0

Options
Warnings
Optimization
Don't Use Boost
Compiler Default
no pedantic
セオライド・テクノロジー㈱株式会社フィックスターズ
Siv3D

Author

anonymous

1 minute ago

›
⌄
⌄
⌄
⌄
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <iostream>
#include <vector>
using namespace std;
int main() {
vector<int> nums;
int elm, store, value, i, j;
cin >> elm;
for (int i = 0; i < elm; i++) {
cin >> value;
nums.push_back(value);
}
for (i = 0; i < elm; i++) {
store = 1;
for (j = 0; j < elm; j++) {
if (i==j) continue;
else store *= nums[j];
}
nums[i] = store; // Not able to assign
}
for (i = 0; i < elm; i++) cout << nums[i] << " ";
return 0;
}
›
9
1
2
5 1 2 3 4 5

$ g++ prog.cc -Wall -Wextra -I/opt/wandbox/boost-1.79.0-gcc-12.1.0/include -std=gnu++2b
120 7200 17280000 -1226571776 0 
Exit Code:
0
セオライド・テクノロジー㈱株式会社フィックスターズ
Siv3D