قُلْ إِنَّ صَلَاتِي وَنُسُكِي وَمَحْيَايَ وَمَمَاتِي لِلَّـهِ رَبِّ الْعَالَمِينَ - الأنعام: ١٦٢

Showing posts with label ACM. Show all posts
Showing posts with label ACM. Show all posts

Wednesday, September 30, 2009

Problem Solving

السلام عليكم و رحمة الله و بركاته

I came through three interesting links yesterday. May be they are common, I'm not really sure.
Here they are..

-UVA toolkit
Here you can browse for a problem, write the Input & it generates the output for you.
Perfect for testing when you think you have the problem right :)
It also links you to the problem statement and the statistics of the problem.


Here, there are 2 useful links
  • C programming basic
  • Algorithm
  • Math puzzle
  • IQ
where you can check the source codes of some problems.


If you navigated to the "UVa" on the left side, you can choose a volume and browse for problems.
Then you can check the category & difficulty of your problem.
If you chose a specific problem, you get some hints for it & sometimes the code is available too.

Monday, September 28, 2009

Detecting the "Enter" key

السلام عليكم و رحمة الله و بركاته

This is a short post.
almost a year ago, I tried to solve a problem on the UVa and i got it "Time limit exceeded". I knew before submitting that it won't be accepted, as i didn't know how to detect the "Enter" key press and it was needed as a stop condition for the first loop :D

anyway, here we go
if you are trying to use "cin" then you'll not be able to detect the new line.
when debugging, u may enter 10 new lines & then a value...i mean it will wait for the value and won't consider the new lines!

you may go to a lower level
if(cin.get() == '\n')
but that's when u are expecting the enter to be pressed
as it reads 1 char only

or u can use "cin.getline()"
and then check for the string's length
if == 0 then "Enter" is pressed
That's useful when u r expecting a mix of strings & enters


sources:
ACMaa Magdi (thanks :))

Friday, August 14, 2009

yes we can!


السلام عليكم و رحمة الله و بكراته

Yesterday was the warm up contest for this summer and my team decided to join.

Our team name is "yes we can!". and before the contest, instead of preparing ourselves we said:
"yes we can...but who said that we will? :D", As our main aim was to spend some time together, have fun & use our brains :D

During the contest, mino said more than once:
"This problem is very easy, let's go to another one :D". The funny thing about that is that she meant what she said :D. Her slogan was "Thinking not Balloons :D"

The day went really nice. and the 3 of us had fun -which was the whole point of us participating- and we also won 2 balloons :D . After the contest, there was an event to honor those who won and also to announce the new committee. I was too tired to attend :( but i knew the details from my friends and I knew it went fine el7amdulellah :)

Thank you mino & s0risAr for this nice day =)
I know that both of you had some problems in attending and staying till the end.
I totally appreciate it.

love you both :)