Compile Error
foo.cc: In function 'int main()': foo.cc:15:17: error: 'vector' was not declared in this scope 15 | vector<long long>b; | ^~~~~~ foo.cc:2:1: note: 'std::vector' is defined in header '<vector>'; did you forget to '#include <vector>'? 1 | #include <iostream> +++ |+#include <vector> 2 | foo.cc:15:24: error: expected primary-expression before 'long' 15 | vector<long long>b; | ^~~~ foo.cc:16:28: error: 'b' was not declared in this scope 16 | if(n%2!=0) b.push_back(n); | ^ foo.cc:18:28: error: 'b' was not declared in this scope 18 | if(m%2!=0) b.push_back(m); | ^ foo.cc:20:28: error: 'b' was not declared in this scope 20 | if(k%2!=0) b.push_back(k); | ^ foo.cc:22:21: error: conflicting declaration 'int n' 22 | int n=(int)b.size(); | ^ foo.cc:11:27: note: previous declaration as 'long long int n' 11 | long long n,m,k; | ^ foo.cc:22:28: error: 'b' was not declared in this scope 22 | int n=(int)b.size(); | ^
Code
#include <iostream>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
long long n,m,k;
cin>>n>>m>>k;
long long count=0;
long long maxio=0;
vector<long long>b;
if(n%2!=0) b.push_back(n);
else count+=n;
if(m%2!=0) b.push_back(m);
else count+=m;
if(k%2!=0) b.push_back(k);
else count+=k;
int n=(int)b.size();
for(int i=0;i<n;i++)
{
maxio=max(maxio,b[i]);
}
count+=maxio;
cout<<count<<endl;
}
return 0;
}
Information
- Submit By
- Type
- Submission
- Problem
- P1195 B. Palindrome
- Contest
- Brain Booster #10
- Language
- C++17 (G++ 13.2.0)
- Submit At
- 2025-06-13 15:52:30
- Judged At
- 2025-06-13 15:52:30
- Judged By
- Score
- 0
- Total Time
- 0ms
- Peak Memory
- 0 Bytes