Category: Problem Solution

19
Feb
2016

UVA Solutions 10055 – Hashmat the Brave Warrior

#include<bits/stdc++.h> using namespace std; int main() { long long int a,b,diff; while((scanf(“%lld%lld”,&a,&b)!=EOF)) { diff=abs(a-b); printf(“%lld\n”,diff); } return…

19
Feb
2016

SPOJ Solution – TEST – Life, the Universe, and Everything

#include<bits/stdc++.h> using namespace std; int main() { int a,t; while(1){ scanf(“%d”,&a); if(a==42){ break; } else{ printf(“%d\n”,a); }…

07
Feb
2016

UVA 11479 – Is this the easiest problem?

Accepted code: #include<bits/stdc++.h> using namespace std; int main() { int testcases,cases; long a,b,c; scanf(“%d”,&testcases); if(testcases>0 && testcases<20)…

06
Feb
2016

Uva Solution – 10783 Odd Sum

Code: #include<bits/stdc++.h> using namespace std; int main() { int testcase,cs,j,a,b,low,high; int counter=0; scanf(“%d”,&testcase); for(cs=1; cs<=testcase; cs++) {…

05
Feb
2016

Uva 12577 – Hajj-e-Akbar

#include<iostream> #include<cstring> #include<cstdio> using namespace std; int main(){ char ary[6]; int counter=0; while(1) { gets(ary); if(ary[0]==’*’) {…

05
Feb
2016

Uva 1124 – Celebrity jeopardy

#include<cstdio> int main() { char s[100]; while(gets(s)){ printf(“%s\n”,s); } return 0; }