Page 10 of 16
Posted: Mon Feb 26, 2007 6:16 am
by mf
helloneo wrote:Input doesn't have a blank line.. because..
The given lines will contain none of the first 32 or last 128 ASCII characters
Well, it doesn't (and that's strange, given who's the problemsetter

).
But I don't see how that is implied by the part of the problem statement that you quote. It just says there will be no whitespaces or any 'weird' characters in lines.
Posted: Mon Feb 26, 2007 6:28 am
by helloneo
Well.. I kind of misunderstood.. and my AC program totally takes care of the input contains blank line..
My output for stcheungj's input
10062 W.A.
Posted: Sat Mar 10, 2007 2:24 pm
by lumier
I can't find where my program is failing...
Help please! Thank you
Code: Select all
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
using namespace std;
bool comp(char a, char b){
return a > b;
}
typedef pair<int, int> P;
int main(){
string a;
int cont = 0;
while (cin >> a){
if (cont != 0) cout << endl;
erre = 1;
sort(a.begin(), a.end(), comp);
int n = a.size();
vector<P> v;
int c = 1;
char ch;
int max = 0;
for (int i = 0; i < n; ++i){
if (a[i] == a[i + 1]){
++c;
}
else {
P aux;
aux.first = a[i];
aux.second = c;
v.push_back(aux);
if (c > max) max = c;
c = 1;
}
}
n = v.size();
for(int j = 1; j != max + 1; ++j){
for (int i = 0; i < n; ++i){
if(v[i].second == j) cout << v[i].first << " " << v[i].second << endl;
}
}
}
}
Thanks a lot
Posted: Sat Mar 10, 2007 4:43 pm
by Debashis Maitra
You didnt tell what is your problem
I have compiled your code in G++ compiler
if gives me following message
Code: Select all
10062.cpp: In function int main():
10062.cpp:18: error: erre was not declared in this scope
I think your output format is also not correct
Sometimes you can get WA instead of PE in the case of string related problem
10062
Posted: Sat Mar 10, 2007 11:12 pm
by arakdev
I have tried any change in possition of "\n" in my program and I think 90 % percent who solved this problem first got PE . So one helper who got AC , please put the printing section of him/her program.Please Don't help by telling put \n here or here ? Copy Printing Section of Your program Plz.
here's my code
for(i=0;i<row;i++)
{
printf("%d %d",result[0],result[1]);
if(i!=row-1) printf("\n");
}
printf("\n");
Plz Help
Posted: Sun Mar 11, 2007 8:23 pm
by Debashis Maitra
Read output format
Code: Select all
A blank line should separate each set of output.
That means there is a blank line between 2 test case
And dont open a new thread if there is one already
Use previous posts to post your problem
I finally Finished it ... PE >> AC
Posted: Sun Mar 11, 2007 9:32 pm
by arakdev
Thanks to Debashis Maitra for his useful help, that was a good help, short and useful , He mentioned to important point instead of confusing me.
Here is accepted code :
int time =0 ;
if(time) printf("\n");
else time=1;
....
for(i=0;i<row;i++)
printf("%d %d\n",result[0]
,result[1]);
hope to work for others too, 
Posted: Sun Mar 11, 2007 10:05 pm
by Debashis Maitra
Thats good
Most of the time you can get PE for new line or printing spaces
So next time read the output format of your problem carefully and get AC
Keep posting and enjoy programming
WHy output limit exceed
Posted: Sun Mar 18, 2007 11:09 am
by Oronno
I have done this problem; it show right answer for all testing input. But when i submit it, it show output limit exceed!
why?
Please help me or give me some test input&output
Posted: Sun Mar 18, 2007 11:42 am
by helloneo
Your program doesn't end..
change
to
Posted: Fri Apr 20, 2007 5:37 pm
by ranacse05
Where is the bug?
#include<stdio.h>
#include<string.h>
int main()
{
char a[1000];
int i,j;
int c[160],v[160];
int ln,t;
while(gets(a))
{
ln=strlen(a);
for(i=0;i<160;i++)
{
v=i+33;
c=0;
}
for(j=33;j<194;j++)
for(i=0;i<ln;i++)
{
if(a==j)
c[j-33]++;
}
for(i=0;i<=159;i++)
for(j=i+1;j<=160;j++)
{
if(c>c[j])
{
t=c;
c=c[j];
c[j]=t;
t=v;
v=v[j];
v[j]=t;
}
}
for(i=0;i<160;i++)
if(c!=0)
printf("%d %d\n",v,c[i]);
}
return 0;
}
Posted: Sat Apr 21, 2007 4:14 pm
by Jan
Need some sample I/O for 10062
Posted: Sun Apr 22, 2007 8:48 am
by ranacse05
Please give me some samplz I/O for 10062
Posted: Sun Apr 22, 2007 10:36 am
by abdullah<cse du>
ranacse05,
Try this input.
Input
Code: Select all
ihgvnkjhweriwujnmnvj54235443###^%--===
!@##$$%$#^&&++'~~~[][][{}{}QDXFGTYYVewqhvvxcfd))))6545209878??;;::
23102125456402154540324165410231654
jhjkhjhdfjfhdkjh
Output
Code: Select all
117 1
114 1
109 1
107 1
103 1
101 1
94 1
50 1
37 1
119 2
118 2
105 2
104 2
53 2
51 2
45 2
110 3
106 3
61 3
52 3
35 3
120 1
119 1
113 1
104 1
102 1
101 1
100 1
99 1
94 1
88 1
86 1
84 1
81 1
71 1
70 1
68 1
64 1
57 1
55 1
54 1
52 1
50 1
48 1
39 1
37 1
33 1
125 2
123 2
118 2
93 2
89 2
63 2
59 2
58 2
56 2
53 2
43 2
38 2
126 3
91 3
36 3
35 3
41 4
54 3
51 3
48 4
53 6
50 6
49 6
52 7
107 2
102 2
100 2
106 5
104 5
I think this will help you.
ABDULLAH.
Reply
Posted: Tue Apr 24, 2007 6:13 pm
by ranacse05
abdullah bhai my output is
Output
Code: Select all
107 1
117 1
37 1
109 1
94 1
101 1
50 1
114 1
103 1
51 2
53 2
45 2
104 2
105 2
118 2
119 2
61 3
35 3
52 3
110 3
106 3
58 1
39 1
48 1
99 1
100 1
101 1
102 1
33 1
104 1
64 1
50 1
37 1
81 1
52 1
68 1
84 1
54 1
113 1
86 1
70 1
88 1
71 1
119 1
120 1
55 1
94 1
57 1
59 2
38 2
93 2
118 2
56 2
53 2
63 2
43 2
123 2
89 2
125 2
35 3
91 3
36 3
41 3
126 3
51 3
54 3
48 4
49 6
53 6
50 6
52 7
102 2
107 2
100 2
104 5
106 5
Is it ok ? I'm still getting WA