Skip to content

Instantly share code, notes, and snippets.

@nazmulpcc
Created January 1, 2020 08:03
Show Gist options
  • Save nazmulpcc/2de62eb30d255b70da91c96a88401d37 to your computer and use it in GitHub Desktop.
Save nazmulpcc/2de62eb30d255b70da91c96a88401d37 to your computer and use it in GitHub Desktop.
Contest Link: https://codeto.win/contest/28 password: mock1920
DO YOURSELF
#include <stdio.h>
int main(){
long long i, n, s, k, mn = 1000000000000000001;
scanf("%lld%lld", &n, &k);
for(i=0; i<k; i++){
scanf("%lld", &s);
if(s%n == 0 || s%n == 1){
if(s < mn){
mn = s;
}
}
}
if(mn == 1000000000000000001)
printf("-1\n");
else
printf("%lld\n", mn);
return 0;
}
#include <stdio.h>
int main(){
int i, n, a, mx = 0, cnt = 0;
scanf("%d", &n);
for(i=0; i<n; i++){
scanf("%d", &a);
if(mx < a){
mx = a;
cnt = 0;
}
if(mx == a){
cnt++;
}
}
printf("%d\n", cnt);
}
#include <stdio.h>
int main(){
int i, n, a[100001], mx = 0, cnt = 0;
scanf("%d", &n);
for(i=0; i<n; i++){
scanf("%d", &a[i]);
}
for(i=0; i<n; i++){
if(mx < a[i]){
mx = a[i];
}
}
for(i=0; i<n; i++){
if(mx == a[i]){
cnt++;
}
}
printf("%d\n", cnt);
}
#include <stdio.h>
int main(){
int i, n, a, b, mn;
scanf("%d", &n);
for(i=0; i<n; i++){
scanf("%d%d", &a, &b);
if(a < b)
mn = a;
else
mn = b;
if(mn%2 == 0)
printf("Sudipto\n");
else
printf("Saddam\n");
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment