Skip to content

Commit

Permalink
Initialize gitignore and add few codechef solutions. (gopalgoel19#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
roh-7 authored and gopalgoel19 committed Oct 31, 2017
1 parent 6e87191 commit be283ab
Show file tree
Hide file tree
Showing 5 changed files with 103 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
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
12 changes: 12 additions & 0 deletions codechef/hso8test.cpp
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;
}
20 changes: 20 additions & 0 deletions codechef/sumtrian.cpp
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;
}
37 changes: 37 additions & 0 deletions codeforces/236a.cpp
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;
}
30 changes: 30 additions & 0 deletions codeforces/540a.cpp
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;
}

0 comments on commit be283ab

Please sign in to comment.