initial commit

This commit is contained in:
ShazidMahsrafi 2023-08-03 02:43:23 +06:00
parent 19cd88d7d3
commit b33f33c32b
2 changed files with 85 additions and 0 deletions

View File

@ -0,0 +1,41 @@
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
void solve()
{
int n;
cin>>n;
vector<int>v;
for(int i=0; i<n; ++i)
{
int x;
cin>>x;
v.push_back(x);
}
int d=abs(v[0]-v[n-1]);
int x=1, y=n;
for(int i=1; i<n; i++)
{
int c=abs(v[i]-v[i-1]);
if(c<d)
{
d=c;
x=i;
y=i+1;
}
}
cout<<x<<" "<<y<<endl;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int TC = 1;
// cin >> TC;
// cin.ignore();
while (TC--) solve();
}

View File

@ -0,0 +1,44 @@
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
void solve()
{
int n,t;
cin >> n >> t;
string s;
if (t == 10)
{
if(n==1)
{
cout<<-1<<endl;
return;
}
s += '1';
for (int i = 0; i < n - 1; i++)
{
s += '0';
}
}
else
{
char c=t+'0';
for (int i = 0; i < n; i++)
{
s += c;
}
}
cout << s << endl;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int TC = 1;
// cin >> TC;
// cin.ignore();
while (TC--)
solve();
}