ENG  RUSTimus Online Judge
Online Judge
Задачи
Авторы
Соревнования
О системе
Часто задаваемые вопросы
Новости сайта
Форум
Ссылки
Архив задач
Отправить на проверку
Состояние проверки
Руководство
Регистрация
Исправить данные
Рейтинг авторов
Текущее соревнование
Расписание
Прошедшие соревнования
Правила
вернуться в форум

Обсуждение задачи 1263. Выборы

Adil_INF-11_BQU Pascal vs C/C++ :( [29] // Задача 1263. Выборы 2 фев 2006 16:25
I solved this problem on Pascal and was AC. But i wrote same program on C and C++. It gives same answers on same tests on my machine but gives WA on test 1 when i submit.
These my programs:

On pascal::

var
a:array[1..10000] of integer;
k,n,m,i:integer;
s:longint;

procedure cle;
var i:integer;
begin
for i:=1 to n do a[i]:=0;
end;

begin
read(n,m);
cle;
s:=0;
for i:=1 to m do begin
readln(k);
if k<>0 then
inc(a[k]);
end;


for i:=1 to n do begin
if a[i]<>0 then
writeln(a[i]/m*100:2:2,'%')
else writeln('0.00%');
end;

end.




On C:

#include <stdio.h>

void main(){
int k,n,m,i;
int a[10000];

scanf("%d %d\n",&n,&m);

for (i=1;i<=n;i++) a[i]=0;

for (i=1;i<=m;++i){
scanf("%d",&k);
if (k!=0) a[k]++;
}


for (i=1;i<=n;++i){
if (a[i]!=0) printf("%2.2f%\n",(float)a[i]/m*100);
else printf("0.00\n");
}

}
GaLL Re: Pascal vs C/C++ :( [24] // Задача 1263. Выборы 3 фев 2006 13:51
1) Use "double" instead of "float".
2) Don't use Pascal, 'cause C++ is really cool language.
P.S. I don't understand how can people write theese "begin ... end" so many times?
Dmitry 'Diman_YES' Kovalioff LOL ^_^ (+) [19] // Задача 1263. Выборы 3 фев 2006 15:46
I don't understand people who think they are cool enough to speak such foolish things ;) Pascal is not worse than C++, and it is up to one to choose what language to use - as for me I use Pascal and I am in Top 10 :) Safe Bird uses C++ - but he does not scream that C++ is better...

P.S. Sorry, can not control myself when Pascal in under attack ;)
+FAMAS+ +++ [12] // Задача 1263. Выборы 3 фев 2006 22:09
RESPECT++++++ PASCAL RULEZZZ!!!!
Vladimir Yakovlev (USU) Re: +++ [11] // Задача 1263. Выборы 4 фев 2006 00:22
Hmm... Pascal is not spported at World Finals now.
Best programmers have started using Java.
Maybe Timus must do the same - substitute Pascal to Java.
Dmitry 'Diman_YES' Kovalioff I doubt you will ;) Calm down, everyone. It was a joke. (+) // Задача 1263. Выборы 4 фев 2006 00:38
Don't you want to double all timelimits for "fast" Java programs to pass them? :)))
Adil Aliev INF-11(BSU - app. math.) Re: +++ [1] // Задача 1263. Выборы 4 фев 2006 03:27
oooh. Yesss.
Java is good. I will glad if timus add Java compiler to this contest
Michael Rybak (accepted@ukr.net) But please without removing Pascal!!! (-) // Задача 1263. Выборы 4 фев 2006 04:16
-
+FAMAS+ Re: +++ [7] // Задача 1263. Выборы 4 фев 2006 12:23
"Pascal is not spported at World Finals now" - с этого года что ли?

Pascal die?
Vladimir Yakovlev (USU) Re: +++ [5] // Задача 1263. Выборы 4 фев 2006 14:42
Pascal provided but not supported
read this: http://icpc.baylor.edu/systems/finals/pascal.htm

Pascal will not be removed from Timus of course.
Java will be added as soon as possible, but not to February, 11. It is possible to recalculate all timelimits for Java. But it is impossible to make all problems solvable in Java.

Edited by author 04.02.2006 15:05
ACM.Tolstobrov_Anatoliy[Ivanovo SPU] :) [1] // Задача 1263. Выборы 4 фев 2006 18:58
deleted

Edited by author 26.10.2018 14:38
ACM.Tolstobrov_Anatoliy[Ivanovo SPU] Re: :) // Задача 1263. Выборы 4 фев 2006 19:01
deleted

Edited by author 26.10.2018 14:37
Fyodor Menshikov Re: +++ [2] // Задача 1263. Выборы 13 фев 2009 23:53
Vladimir Yakovlev (USU) писал(a) 4 февраля 2006 14:42
It is possible to recalculate all timelimits for Java. But it is impossible to make all problems solvable in Java.

It's possible. :-)))

http://acm.timus.ru/status.aspx?space=1&num=1220&author=23793
http://acm.timus.ru/status.aspx?space=1&num=1306&author=23793
1275 is coming soon.

Edited by author 13.02.2009 23:53
Vedernikoff Sergey (HSE: EconomicsForever!) Re: +++ [1] // Задача 1263. Выборы 16 фев 2009 03:38
And why it is problem to solve it in Java? What we need for solution - just one array int[1000]
But I really don't understand why timelimit is so small - memory is not crucial part of this problem at all...
Fyodor Menshikov Re: +++ // Задача 1263. Выборы 16 фев 2009 12:16
Vedernikoff Sergey (HSE: EconomicsForever!) писал(a) 16 февраля 2009 03:38
memory is not crucial part of this problem at all...

Maybe author wanted to cut off DP way of solving this problem or something like this.
GaLL Re: LOL ^_^ (+) [5] // Задача 1263. Выборы 6 фев 2006 14:36
I did't say that Pascal is bad, nasty, ugly, damned language or something like it. But... U must agree with me that up to now there is no compiler for Pascal that can be compared with MVC++ or g++. Theese make really good machine code. :) And IMHO this language is uncomfortable to write algorithms and serious projects. What for Top 10... over some year Top 10 or even Top 50 can became consisting only of Pascal (or - that's terrible - Java) users. Even BASIC coders could be cool because they ARE cool. You think we prefer language? Often programming language prefers us. Pascal is popular in Russia just because of traditions  begun with 80's.
P.S. I accept your apology, but "LOL" is offensive, don't you think?
+FAMAS+ ДА ЧЕ ТЫ НАПРЯГСЯ? РАСЛАБСЯ! [4] // Задача 1263. Выборы 6 фев 2006 15:50
ДИМАН VERY GOOD MAN, НАПИСАЛ LOL, НАПИШИ ЕМУ ТАКЖЕ:)
Grebnov Ilya[Ivanovo SPU] Pascal is not spported at World Finals now :( [3] // Задача 1263. Выборы 7 фев 2006 21:38
I suggest to make a voting. I use pascal about 5 years for solving problems. And as for me, I think that pascal is not so uncomfortable to write algorithms.



Edited by author 07.02.2006 21:39
NIM Re: Pascal is not spported at World Finals now :( [2] // Задача 1263. Выборы 8 фев 2006 13:52
Hi! I'm first time here and seems the last - cause there is no Java support. Are you going to add it soon?
Vahagn Nalbandyan Pascal VS C++ [1] // Задача 1263. Выборы 11 фев 2006 00:21
Pascal is the worst language I ever seen.....
Alexander Prokazyuk (TKTL) Re: Pascal VS C++ // Задача 1263. Выборы 18 окт 2006 08:02
Shut up! Pascal Will Newer Die!

Edited by author 18.10.2006 08:05
hx Re: Pascal vs C/C++ :( [3] // Задача 1263. Выборы 11 фев 2009 16:15
In C++ very hard syntax, and Pascal is good language too
Vedernikoff Sergey (HSE: EconomicsForever!) Re: Pascal vs C/C++ :( [2] // Задача 1263. Выборы 11 фев 2009 18:29
Currently I'm using C++ for solving problems, but can say: Pascal foreva! C++ has many drawbacks which are worse than just long "begin .. end"
[SPbSU ITMO] WiNGeR Re: Pascal vs C/C++ :( [1] // Задача 1263. Выборы 13 фев 2009 22:34
I solved problems using all languages available on this server and Java seems to be most convenient for me..
yaho0o0 Re: Pascal vs C/C++ :( // Задача 1263. Выборы 8 апр 2009 15:04
#include <iostream>
#include <stdio.h>
using namespace std;
int main()
{
    int br[10024],i,m;
    double n,a;
    float sum;
    cin>>n>>a;
    sum=100/a;
    for(i=1;i<=10024;i++)
    {
        br[i]=0;
    }
    for(i=1;i<=a;i++)
    {
        cin>>m;
        br[m]++;
    }
    for(i=1;i<=n;i++)
    {

         printf("%.2lf",(br[i]*sum));
         cout<<"%"<<endl;
    }
    return 0;
}
void off() Re: Pascal vs C/C++ :( [1] // Задача 1263. Выборы 3 фев 2006 17:46
1) Look how your C++ program will work with n=10000;)
2) You've forgotten about percent sign in else printf("0.00\n");
3) Don't use % in printf, use %% (it will show as %)
4) LEARN C++ well before writing on it!

Edited by author 03.02.2006 17:57
Michael Rybak (accepted@ukr.net) Re: Pascal vs C/C++ :( // Задача 1263. Выборы 3 фев 2006 22:02
>> 2) You've forgotten about percent sign in else printf("0.00\n");

Is it really necessary?
fallen Re: Pascal vs C/C++ :( // Задача 1263. Выборы 22 май 2009 17:46
Holywar on timus=). Lol.
rkkautsar Re: Pascal vs C/C++ :( // Задача 1263. Выборы 13 окт 2012 15:06
Can anyone translate my solution below into C++? I want to learn programming in C/C++ too :)

type TArray=array of dword;
var arr:TArray;
m,n,c,i:dword;
begin
readln(n,m);
setlength(arr,n+1);
for i:=1 to n do arr[i]:=0;
for i:=1 to m do begin
readln(c);
arr[c]+=1;
end;
for i:=1 to n do begin
writeln((arr[i]*100/m):2:2,'%');
end;
end.