You are not logged in. Please login at www.codechef.com to post your questions!

×

whats wrong in this code? even it is running on turbo c++ and dev c++

#include<iostream>
using namespace std;
int main()
{

int T,i,j,N,a[26];
char str[50000];
cin>>N;
int store[N],s=0;
for(T=0;T<N;T++)
{
int sum=0,m=0,count=0;
for(i=0;i<26;i++)
{
cin>>a[i];
}

cin>>str;

while(str[m]!='\0'){
    count++;
    m++;
}  
for(i=1;i<=26;i++)
{
for(j=0;j<count;j++)
{
int val = int(str[j]);
if((val-96)==i)
break;
}
if(j==count)
sum = sum+i;
}
cout<<sum<<"\n";
}
return 0;
}

asked 09 Sep '17, 00:34

ipankaj's gravatar image

0★ipankaj
1
accept rate: 0%

edited 10 Sep '17, 00:12

vijju123's gravatar image

5★vijju123 ♦♦
15.4k12066

1

Can you provide the question link

(09 Sep '17, 00:58) kunnu1202★

code of the question MATPAN

(09 Sep '17, 19:06) ipankaj0★

Its hard to read the code can upload it on github or similar and share the link

link

answered 09 Sep '17, 23:39

phantomhive's gravatar image

4★phantomhive
944
accept rate: 0%

toggle preview
Preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:

×22

question asked: 09 Sep '17, 00:34

question was seen: 321 times

last updated: 10 Sep '17, 00:12