initial commit
This commit is contained in:
parent
c556caa6ff
commit
181721e495
29
1846A Rudolph and Cut the Rope/1846A.cpp
Normal file
29
1846A Rudolph and Cut the Rope/1846A.cpp
Normal file
@ -0,0 +1,29 @@
|
||||
#include<bits/stdc++.h>
|
||||
using namespace std;
|
||||
using ll = long long;
|
||||
|
||||
|
||||
void solve()
|
||||
{
|
||||
int n;
|
||||
cin>>n;
|
||||
int ct=0;
|
||||
for(int i=0; i<n; ++i)
|
||||
{
|
||||
int x,y;
|
||||
cin>>x>>y;
|
||||
if(x>y) ct++;
|
||||
}
|
||||
cout<<ct<<endl;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
ios_base::sync_with_stdio(false);
|
||||
cin.tie(nullptr);
|
||||
|
||||
int TC = 1;
|
||||
cin >> TC;
|
||||
cin.ignore();
|
||||
while (TC--) solve();
|
||||
}
|
36
1851A Escalator Conversations/1851A.cpp
Normal file
36
1851A Escalator Conversations/1851A.cpp
Normal file
@ -0,0 +1,36 @@
|
||||
#include<bits/stdc++.h>
|
||||
using namespace std;
|
||||
using ll = long long;
|
||||
|
||||
|
||||
void solve()
|
||||
{
|
||||
int n, m, k, H;
|
||||
cin>>n>>m>>k>>H;
|
||||
vector<int>v;
|
||||
for(int i=0; i<n; ++i)
|
||||
{
|
||||
int x;
|
||||
cin>>x;
|
||||
v.push_back(x);
|
||||
}
|
||||
int ct=0;
|
||||
for(int i=0; i<n; ++i)
|
||||
{
|
||||
int d=abs(H-v[i]);
|
||||
if(d<=(m-1)*k && d%k==0 && v[i]!=H)
|
||||
ct++;
|
||||
}
|
||||
cout<<ct<<endl;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
ios_base::sync_with_stdio(false);
|
||||
cin.tie(nullptr);
|
||||
|
||||
int TC = 1;
|
||||
cin >> TC;
|
||||
cin.ignore();
|
||||
while (TC--) solve();
|
||||
}
|
Loading…
Reference in New Issue
Block a user