Posts

CodeChef::HORSES

  #include <bits/stdc++.h> using namespace std ; int main (){ int t ; cin >> t ; while (t--){ int n ; cin >> n ; int s[n] ; for ( int i = 0 ; i < n ; ++i) { cin >> s[i] ; } sort(s , s+n) ; long long int smallest{ INT64_MAX } ; for ( int i = 0 ; i < n - 1 ; ++i) { if (s[i+ 1 ] - s[i] < smallest){ smallest = s[i+ 1 ] - s[i] ; } } cout << smallest << ' \n ' ; } return 0 ; }

CodeChef::FCTRL

  #include <bits/stdc++.h> using namespace std ; int main (){ long long int t ; cin >> t ; while (t--){ long long int n ; cin >> n ; long long int no_of_zeros{ 0 } ; while (n/ 5 >= 1 ){ n = n/ 5 ; no_of_zeros += n ; } cout << no_of_zeros << ' \n ' ; } return 0 ; }

CodeChef::TEST

  #include <bits/stdc++.h> using namespace std ; int main (){ int num{ 0 } ; while (num != 42 ){ cin >> num ; if (num != 42 ){ cout << num << ' \n ' ; } } return 0 ; }

CodeChef::SNCKYEAR

  #include <bits/stdc++.h> using namespace std ; int main (){ int t ; cin >> t ; while (t--){ int n ; cin >> n ; if (n== 2010 or n== 2015 or n== 2016 or n== 2017 or n== 2019 ){ cout << "HOSTED" << ' \n ' ; } else { cout << "NOT HOSTED" << ' \n ' ; } } }

CodeChef::DIFFSUM

  #include <bits/stdc++.h> using namespace std ; int main (){ int n1 ; int n2 ; cin >> n1 ; cin >> n2 ; if (n1 > n2) cout << n1-n2 << ' \n ' ; else cout << n1+n2 << ' \n ' ; return 0 ; }

CodeChef::FLOW10

  #include <bits/stdc++.h> using namespace std ; int main (){ int t ; cin >> t ; while (t--){ char id ; cin >> id ; if (id == 'B' or id == 'b' ) cout << "BattleShip" << ' \n ' ; if (id == 'C' or id == 'c' ) cout << "Cruiser" << ' \n ' ; if (id == 'D' or id == 'd' ) cout << "Destroyer" << ' \n ' ; if (id == 'F' or id == 'f' ) cout << "Frigate" << ' \n ' ; } return 0 ; }

CodeChef::PRB01

  #include <bits/stdc++.h> using namespace std ; int main (){ int t ; cin >> t ; while (t--){ int n , i , m= 0 , flag= 0 ; cin >> n ; m=n/ 2 ; if (n== 1 or n== 0 ){ cout << "no" << ' \n ' ; flag = 1 ; } for (i = 2 ; i <= m ; i++) { if (n % i == 0 ) { cout << "no" << ' \n ' ; flag= 1 ; break; } } if (flag== 0 ) cout << "yes" << ' \n ' ; } return 0 ; }