Search found 6 matches

by Deny Sutani
Fri Jun 08, 2007 10:26 am
Forum: Volume 5 (500-599)
Topic: 583 - Prime Factors
Replies: 171
Views: 61298

I try to change my code. It produces RE(Signal 8)


#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#define max 50000
long bil_prima[5133];

bool prime[max+1];

void prima()
{
int i,j,x=0;
int limit = (int) sqrt(max)+1;
for (i=1;i<=max;i++) prime[i] = i&1;
prime[0] = prime[1] = false ...
by Deny Sutani
Wed Jun 06, 2007 6:50 pm
Forum: Volume 5 (500-599)
Topic: 583 - Prime Factors
Replies: 171
Views: 61298

At the first time, I make a function to generate all prime between 1-50000. I think if i remake my code like that, it will increase the process.

In my real code it's written like this

long bil_prima[10000]={
2, 3, 5, 7, 11, 13, 17, 19,..., 49853, 49871, 49877, 49891, 49919, 49921, 49927, 49937 ...
by Deny Sutani
Wed Jun 06, 2007 8:31 am
Forum: Volume 5 (500-599)
Topic: 583 - Prime Factors
Replies: 171
Views: 61298

I got CE with this code

#include <stdio.h>
#include <math.h>
#include <stdlib.h>

long bil_prima[10000]={prime number between 1-50000}

int prime(long angka)
{
int prime;

if(angka==1) prime = 0;
if(angka==2) prime = 1;
if(angka==3) prime = 1;
else
for(long j=2; j<=sqrt(angka);j++)
{
if ...
by Deny Sutani
Wed Jun 06, 2007 5:50 am
Forum: Volume 104 (10400-10499)
Topic: 10469 - To Carry or not to Carry
Replies: 24
Views: 15816

Re: hiiiiiiiii

nikhil wrote:just print...
(a^b)
get accccccccccccccc
thx.
OMG, I wasted my time to convert a and b to binary number and XoR them. With my previous code, I got WA. But with only one line code, I got AC. Thank u very much.
by Deny Sutani
Sun Jun 03, 2007 2:00 pm
Forum: Volume 106 (10600-10699)
Topic: 10696 - f91
Replies: 21
Views: 14721

Re: Why my program use so many memory?

Why my program use 440 :-? memory?(10696)

#include <iostream>

int main()
{
int n,k;
std::cin>>n;
while (n!=0)
{
if (n<=100) std::cout<<"f91("<<n<<") = "<<91<<std::endl;
else std::cout<<"f91("<<n<<") = "<<n-10<<std::endl;
std::cin>>n;
}
return 0;
}

Maybe that one will be better. My code ...
by Deny Sutani
Fri Jun 01, 2007 7:33 am
Forum: Off topic (General chit-chat)
Topic: What is your record of solved problems during one day?
Replies: 18
Views: 73841

it has been a week here in acm.uva.es, i havent solved a single one :cry:

Please never give up. ^_^
For the first time, I felt frustrated because always got AC after several WA or CE.

Keep going :D

Oh, I forgot to answer the topic question. Beacuse I'm still beginner programmer, my record is 4 ...

Go to advanced search