online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
/****************************************************************************** Online C++ Compiler. Code, Compile, Run and Debug C++ program online. Write your code in this editor and press "Run" button to compile and execute it. *******************************************************************************/ #include <bits/stdc++.h> using namespace std; int main() { long long int tc,n,timetaken; cin>>tc; while(tc--){ cin>>n; string s[n]; int time[n]; for(int i=0;i<n;i++){ cin>>s[i]; int count=0; for(int q=0;q<i;q++){ if(s[i]==s[q]){ count++; } } for(int j=0;j<s[i].length();j++){ if(j=0){ time[i]+=0.2; } else{ if(s[i][j]=='f'||s[i][j]=='d'){ if(s[i][j-1]=='f'||s[i][j-1]=='d'){ time[i]+=0.2; } else{ time[i]+=0.4; } } else if(s[i][j]=='j'||s[i][j]=='k'){ if(s[i][j-1]=='j'||s[i][j-1]=='k'){ time[i]+=0.2; } else{ time[i]+=0.4; } } } } if(count>0){ time[i]=time[i]/2; } } for(int a=0;a<n;a++){ timetaken+=time[a]; } cout<<timetaken<<endl; } return 0; }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue