Skip to content

Commit 182ffba

Browse files
committed
Added 629A - Far Relative’s Birthday Cake.cpp
1 parent 12f738f commit 182ffba

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed
+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#include<bits/stdc++.h>
2+
using namespace std;
3+
4+
// Code Written By: Vikash Patel
5+
6+
int main()
7+
{
8+
int n;
9+
cin>>n;
10+
char ch[n][n];
11+
for(int i=0;i<n;i++)
12+
{
13+
for(int j=0;j<n;j++)
14+
{
15+
cin>>ch[i][j];
16+
}
17+
}
18+
int ans=0, c=0;
19+
for(int i=0;i<n;i++)
20+
{
21+
for(int j=0;j<n;j++)
22+
{
23+
c=0;
24+
if(ch[i][j]=='C')
25+
{
26+
for(int k=i+1;k<n;k++)
27+
{
28+
if(ch[k][j]=='C')
29+
c++;
30+
}
31+
for(int k=j+1;k<n;k++)
32+
{
33+
if(ch[i][k]=='C')
34+
c++;
35+
}
36+
}
37+
ans+=c;
38+
}
39+
}
40+
cout<<ans<<endl;
41+
}

0 commit comments

Comments
 (0)