Search found 8 matches

by dma
Tue May 27, 2008 11:32 am
Forum: Volume 100 (10000-10099)
Topic: 10062 - Tell me the frequencies!
Replies: 235
Views: 36654

Re: 10062 - Tell Me the Frequencies!

It said that " If two characters are present the same time print the information of the ASCII character with higher ASCII value first.".
by dma
Sun May 25, 2008 9:39 am
Forum: Volume 100 (10000-10099)
Topic: 10062 - Tell me the frequencies!
Replies: 235
Views: 36654

Re: 10062 - Tell Me the Frequencies!

here is my code. Could anyone give me some I/Os? thanks in advance. #include <stdio.h> #include <stdlib.h> #define DB_SIZE 1024 #define OUT_LEN 1024 static int _pi_cmp_(const void* l, const void* r){ int c = **(int**)l - **(int**)r; if(c) return c; return *(int**)r - *(int**)l; } int main(int argc, ...
by dma
Thu Jan 10, 2008 7:48 am
Forum: Volume 6 (600-699)
Topic: 617 - Nonstop Travel
Replies: 9
Views: 3779

Re: 617(Nonstop Travel) WA!

it's so...
if I compile it without argument -O2, I got the AC! Why?
by dma
Thu Jan 10, 2008 5:40 am
Forum: Volume 6 (600-699)
Topic: 617 - Nonstop Travel
Replies: 9
Views: 3779

617(Nonstop Travel) WA!

please give me more I/O! thanks! #include <iostream> #include <vector> using namespace std; static const int lowest_speed = 30; static const int heighest_speed = 60; class traffic_t{ double _l; int _g, _y, _r; public: bool can_pass(int speed){ double sec = _l*3600/speed; return (sec - (int)(sec/(_g+...
by dma
Sun Dec 30, 2007 9:11 am
Forum: Volume 113 (11300-11399)
Topic: 11371 - Number Theory for Newbies
Replies: 65
Views: 22700

Re: long long... double... HELP!

Hi! I tried to make my code (Is the one all disordered above) with short [] (digit by digit) because I tried to use long long int before and I got WA, and with my rudimentary method (like child) I got AC (obviously it didn't help in the contest) I wanna ask you something: Type Bits int 16 long 32 l...
by dma
Sun Dec 30, 2007 7:57 am
Forum: Volume 113 (11300-11399)
Topic: 11371 - Number Theory for Newbies
Replies: 65
Views: 22700

How can I optimize my solution to run in <=1 sec? Here is my code: #define For(i,b) for(int i = 0; i < (int)b; ++i) #define All(t) t.begin(),t.end() string itos (int i) {stringstream s; s << i; return s.str();} int stoi (string s) {istringstream in(s); int ret; in >> ret; return ret;} string itos (...
by dma
Sun Dec 30, 2007 7:47 am
Forum: Volume 113 (11300-11399)
Topic: 11371 - Number Theory for Newbies
Replies: 65
Views: 22700

sonyckson wrote:"...and the 9999999991 is greater than 2^64!" == FALSE
sorry. you're right. But in C++, long long int seams to be 32-bits.
by dma
Sun Dec 30, 2007 4:27 am
Forum: Volume 113 (11300-11399)
Topic: 11371 - Number Theory for Newbies
Replies: 65
Views: 22700

You are using Big Integers, but actually long long int is enough. With long long int, I think your code would be much shorter and easier to debug. ----- Rio long long int doesn't work, I used double and got AC just now. Although n<=2000000000, how about 1999999999? the maximun of a-b is 9999999991 ...

Go to advanced search