forked from gopalgoel19/Competitive-Programming-Solutions
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initialize gitignore and add few codechef solutions. (gopalgoel19#11)
- Loading branch information
1 parent
6e87191
commit be283ab
Showing
5 changed files
with
103 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
a.out | ||
codechef/a.out | ||
codeforces/a.out | ||
spoj/a.out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#include<stdio.h> | ||
int main(){ | ||
int amt; | ||
float bal; | ||
scanf("%d",&amt); | ||
scanf("%f",&bal); | ||
if(((float)amt+0.5)>bal || amt%5 !=0) | ||
printf("%.2f",bal); | ||
else | ||
printf("%.2f",bal-0.5-(float)amt); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#include <bits/stdc++.h> | ||
int main() | ||
{ | ||
int t; | ||
scanf("%d",&t); | ||
while(t--) | ||
{ | ||
int n; | ||
scanf("%d",&n); | ||
int a[n][n]; | ||
for(int i=0;i<n;i++) | ||
for(int j=0;j<=i;j++) | ||
scanf("%d",&a[i][j]); | ||
for(int i=n-2;i>=0;i--) | ||
for(int j=0;j<=i;j++) | ||
a[i][j]+=((a[i+1][j]>a[i+1][j+1])?a[i+1][j]:a[i+1][j+1]); | ||
printf("%d\n",a[0][0]); | ||
} | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#include<stdio.h> | ||
#include<iostream> | ||
#include<math.h> | ||
#include<string.h> | ||
using namespace std; | ||
int main() | ||
{ | ||
char a[100]; | ||
int b[26]; | ||
int flag=0; | ||
int i,j,c=0; | ||
for (i = 0; i < 26; ++i) | ||
{ | ||
b[i]=0; | ||
} | ||
scanf("%s",a); | ||
for (i = 0; i < strlen(a);i++) | ||
{ | ||
j=a[i]; | ||
j=j-97; | ||
b[j]++; | ||
} | ||
for(i=0;i<26;i++) | ||
{ | ||
if(b[i]>0) | ||
c++; | ||
} | ||
if(c%2==0) | ||
cout<<"CHAT WITH HER!"<<endl; | ||
else | ||
cout<<"IGNORE HIM!"<<endl; | ||
|
||
|
||
|
||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#include<bits/stdc++.h> | ||
using namespace std; | ||
int main() | ||
{ | ||
int n; | ||
cin>>n; | ||
char a[n]; | ||
char b[n]; | ||
int i,j,k; | ||
int c=0; | ||
int d=0; | ||
for(i=0;i<n;i++) | ||
cin>>a[i]; | ||
for(i=0;i<n;i++) | ||
cin>>b[i]; | ||
for(i=0;i<n;i++) | ||
{ | ||
d=abs(b[i]-a[i]); | ||
if(d>5) | ||
{ | ||
if(b[i]>a[i]) | ||
d=(a[i]+10)-b[i]; | ||
else | ||
d=(b[i]+10)-a[i]; | ||
} | ||
c+=d; | ||
} | ||
cout<<c<<endl; | ||
return 0; | ||
} |