Compile Error
foo.cc: In function 'int main()': foo.cc:30:27: error: expected ';' before ':' token 30 | cntg++: | ^ | ; foo.cc:36:34: error: invalid use of member function 'std::vector<_Tp, _Alloc>::size_type std::vector<_Tp, _Alloc>::size() const [with _Tp = int; _Alloc = std::allocator<int>; size_type = long unsigned int]' (did you forget the '()' ?) 36 | for(int i=0; i<v.size; i++) | ~~^~~~ | ()
Code
#include<bits/stdc++.h>
#include<numeric>
using namespace std;
int main()
{
int T;
cin>>T;
while(T--)
{
int N;
cin>>N;
vector<int>v;
int cntg=0;
for(int i=N; i>=1; i--)
{
v.push_back(i);
}
for(int i=0; i<N; i++)
{
for(int i=0; i<N-1; i++)
{
if(gcd(v[i],v[i+1])==1 && v[i]-v[i-1]>1)
{
cntg++:
}
}
if(cntg==N)
{
for(int i=0; i<v.size; i++)
{
cout<<v[i]<<" ";
}
cout<<endl;
}
else next_permutation(v.begin(), v.end());
}
v.clear();
}
}
Information
- Submit By
- Type
- Pretest
- Problem
- P1203 D. Roy Loves Permutation
- Language
- C++17 (G++ 13.2.0)
- Submit At
- 2025-06-13 17:28:11
- Judged At
- 2025-06-13 17:28:11
- Judged By
- Score
- 0
- Total Time
- 0ms
- Peak Memory
- 0 Bytes