Skip to content

Instantly share code, notes, and snippets.

@Anupam02
Last active June 17, 2016 09:10
Show Gist options
  • Select an option

  • Save Anupam02/02712144c279337d617058c489ddf991 to your computer and use it in GitHub Desktop.

Select an option

Save Anupam02/02712144c279337d617058c489ddf991 to your computer and use it in GitHub Desktop.
#include<iostream>
using namespace std;
int main() {
string name;
bool performedGood = false;
int n, lower , upper;
cin>>n;
while(n--) {
cin>>name>>lower>>upper;
if(!performedGood)
if(lower >= 2400 && upper > lower) {
performedGood = true;
}
}
if(performedGood) cout<<"YES"<<endl;
else cout<<"NO"<<endl;
return 0;
}
#include<iostream>
#include<set>
using namespace std;
int main() {
int t,n;
long long int A[30];
cin>>t;
while(t--) {
cin>>n;
set<long long int> myset;
for(int i=0; i<n; i++) cin>>A[i];
for(int i=0; i<n; i++) myset.insert(abs(A[i]));
cout<<myset.size()<<endl;
}
return 0;
}
#include<iostream>
using namespace std;
int main() {
unsigned long int n,k,answer;
cin>>n>>k;
answer = ((n/k)+1)*k;
cout<<answer<<endl;
return 0;
}
#include<iostream>
using namespace std;
int main() {
int n,h,minWidthOfRoad;
cin>>n>>h;
minWidthOfRoad=n;
int A[n];
for(int i=0; i<n; i++) cin>>A[i];
for(int i=0; i<n; i++) if(A[i]>h) minWidthOfRoad++;
cout<<minWidthOfRoad<<endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment