initial commit

This commit is contained in:
ShazidMahsrafi 2023-07-20 02:20:48 +06:00
parent 6fb808554f
commit b677743e0e
2 changed files with 82 additions and 0 deletions

View File

@ -0,0 +1,48 @@
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
void solve()
{
int n;
cin>>n;
vector<int>v;
if(n%4!=0)
cout<<"NO"<<endl;
else
{
int even_sum=0;
int odd_sum=0;
for(int i=2; i<=n; i+=2)
{
v.push_back(i);
even_sum+=i;
}
int ct=0;
for(int i=1; i<n; i+=2)
{
if(ct==(n/2)-1)
break;
v.push_back(i);
odd_sum+=i;
ct++;
}
v.push_back(even_sum-odd_sum);
cout<<"YES"<<endl;
for(auto it:v)
cout<<it<<" ";
cout<<endl;
}
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int TC = 1;
cin >> TC;
cin.ignore();
while (TC--) solve();
}

34
705A Hulk/705A.cpp Normal file
View File

@ -0,0 +1,34 @@
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
void solve()
{
int n;
cin>>n;
string s1=" I hate that";
string s2=" I love that";
string s;
for(int i=1; i<n; i++)
{
if(i & 1)
s+=s1;
else
s+=s2;
}
if(n&1) s=s+" I hate it";
else s=s+" I love it";
cout<<s<<endl;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int TC = 1;
//cin >> TC;
//cin.ignore();
while (TC--) solve();
}