499 - What's The Frequency, Kenneth?
Moderator: Board moderators
Your code will still get WA even if the mistake pointed out by Darko is corrected.
Try this input:
Correct Output is:
But your code prints:
Try this input:
Code: Select all
When riding your bicycle backwards down a one-way street, if the
wheel falls of a canoe, how many ball bearings does it take to fill
up a water buffalo?
Hello Howard.
Testing
Code: Select all
e 6
al 7
a 3
Hlo 2
Teginst 1
Code: Select all
e 6
al 7
a 3
Hlo 2
Try the I/O set. Your code returns wrong...
Input:
Output:
Hope it helps.
Input:
Code: Select all
HHHHHh ................hhhhooooOOO
Code: Select all
Hh 5
Ami ekhono shopno dekhi...
HomePage
HomePage
-
- New poster
- Posts: 30
- Joined: Mon Jun 19, 2006 10:37 pm
- Contact:
mine is even solving it also even then WA
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;
int main()
{ int i,count,j,n;
char m;
bool flag=true,flag1=true;
string line;
vector<int> v;
vector<char> c,d,p;
while (getline(cin,line))
{
for (i=0;i<line.size();i++){
count=0;
m=line;
for (int ee=0; ee<line.size(); ee++)
{
if (isalpha(line[ee]) && m==line[ee])
count++;
}
v.push_back(count);
c.push_back(m);
}
for(i=0;i<v.size();i++)
{
for(j=0;j<v.size();j++)
if (v<v[j] && flag==true)
flag=false;
if (flag==true)
{d.push_back(c);
count=v;
}
flag=true;
}
for(i=0;i<d.size();i++)
{ m=d;
if(m>(char)64 && m<(char)91)
{ for(j=0;j<p.size();j++)
if(p[j]==m)
flag1=false;
if(flag1)
p.push_back(m);
flag1=true;
}
}
for(i=0;i<d.size();i++)
{ m=d;
if(m>(char)96 && m<(char)123)
{ for(j=0;j<p.size();j++)
if(p[j]==m)
flag1=false;
if(flag1)
p.push_back(m);
flag1=true;
}
}
for(i=0;i<p.size();i++)
cout<<p;
cout<<" "<<count;
p.clear();
c.clear();
d.clear();
v.clear();
cout<<endl;
}
return 0;
}
#include<algorithm>
#include<string>
#include<vector>
using namespace std;
int main()
{ int i,count,j,n;
char m;
bool flag=true,flag1=true;
string line;
vector<int> v;
vector<char> c,d,p;
while (getline(cin,line))
{
for (i=0;i<line.size();i++){
count=0;
m=line;
for (int ee=0; ee<line.size(); ee++)
{
if (isalpha(line[ee]) && m==line[ee])
count++;
}
v.push_back(count);
c.push_back(m);
}
for(i=0;i<v.size();i++)
{
for(j=0;j<v.size();j++)
if (v<v[j] && flag==true)
flag=false;
if (flag==true)
{d.push_back(c);
count=v;
}
flag=true;
}
for(i=0;i<d.size();i++)
{ m=d;
if(m>(char)64 && m<(char)91)
{ for(j=0;j<p.size();j++)
if(p[j]==m)
flag1=false;
if(flag1)
p.push_back(m);
flag1=true;
}
}
for(i=0;i<d.size();i++)
{ m=d;
if(m>(char)96 && m<(char)123)
{ for(j=0;j<p.size();j++)
if(p[j]==m)
flag1=false;
if(flag1)
p.push_back(m);
flag1=true;
}
}
for(i=0;i<p.size();i++)
cout<<p;
cout<<" "<<count;
p.clear();
c.clear();
d.clear();
v.clear();
cout<<endl;
}
return 0;
}
win
Try the following I/O set...
Input:
Output:
Your code returns wrong answer for the third case. Hope it helps.
Input:
Code: Select all
bbbAABB.BaaaA
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
zzZZyyAAbb
Code: Select all
ABab 3
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz 1
AZbyz 2
Ami ekhono shopno dekhi...
HomePage
HomePage
-
- New poster
- Posts: 23
- Joined: Tue Sep 12, 2006 9:46 pm
499- getting WA Plz Helpppppppppppppppp!!!!
Can somebuddy tell me wot is the problem with my code? I am repeatedly getting WA 
//REMOVED
thnx in advance

//REMOVED
thnx in advance
Last edited by dust_cover on Fri Oct 06, 2006 9:26 pm, edited 1 time in total.
i wanna give it a try....
give this input:
output should be nothing.[/quote]
Code: Select all
*/*/*/*/*/
-
- New poster
- Posts: 23
- Joined: Tue Sep 12, 2006 9:46 pm
STill WA plz help!!!!!!!!!!!!!!!!!!!!:(
hi sunny i have checked for */*/*/*/*/. my code outputs nothing
But still getting WA !
could u plz help me?????????????
//removed after AC
Thnnx in advance!
But still getting WA !

//removed after AC
Thnnx in advance!
Last edited by dust_cover on Fri Oct 06, 2006 9:25 pm, edited 1 time in total.
i wanna give it a try....
no ur program prints:
Code: Select all
ABC.....XYZabc...xyz 0
-
- New poster
- Posts: 23
- Joined: Tue Sep 12, 2006 9:46 pm
Hi,
I'm not sure anymore whether I have to print ABC...XYZabc...xyz 0 or a blank line or just skip that one.
Does the above work for blank lines nad those without any characters.
It's a simple task but I'm going crazy tryin figure it out.
I'm not sure anymore whether I have to print ABC...XYZabc...xyz 0 or a blank line or just skip that one.
Does the above work for blank lines nad those without any characters.
It's a simple task but I'm going crazy tryin figure it out.
Code: Select all
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
using namespace std;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define SQ(x) (x)*(x)
string solve( string s ) {
int cnt[52]; memset( cnt, 0, sizeof( cnt ) );
for( int i = 0; i < s.size(); ++i ) {
if( s[i] >= 'a' && s[i] <= 'z' ) cnt[ s[i] - 'a' + 26 ]++;
if( s[i] >= 'A' && s[i] <= 'Z' ) cnt[ s[i] - 'A' ]++;
}
int x = *(max_element( cnt, cnt + 52 ) );
string ret = "";
for( int i = 0; i < 26; ++i ) if( cnt[i] == x ) ret += (i + 'A');
for( int i = 26; i < 52; ++i ) if( cnt[i] == x ) ret += (i + 'a' - 26);
ret += " "; ret += ( x + '0' );
return ret;
}
int main() {
string s;
while( getline( cin, s ) )
cout << solve( s ) << endl;
return 0;
}