Quantcast
Channel: CodeChef Discuss - latest questions
Viewing all articles
Browse latest Browse all 40121

WA in HOLES

$
0
0

www.codechef.com/problems/HOLES

The following code gave WA.

include <iostream>

using namespace std;

int holesCalc(char c) { int hole; if(c=='A' | c=='Q' | c=='D' | c=='O' | c=='P' | c=='R') hole=1; else if(c=='B') hole=2; else hole=0; return hole; }

int main() { char a[100]; int holes; int t; cin>>t; while(t>0){ holes=0; cin>>a; for(int i=0;a[i]!='\0';i++)// your code goes here holes=holes + holesCalc(a[i]); cout<<holes; t--; } return 0; }


Viewing all articles
Browse latest Browse all 40121

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>