#include <stdio.h> int main() { int x; double y; while (scanf("%d %lf",&x,&y)==2) { if (!(((double)x+0.5)>y) && !(x%5)) printf("%.2lf\n",y-(double)x-0.5); else printf("%.2lf\n",y); } return 0; }
Monday, February 20, 2012
[Codechef] ATM (HS08TEST)
The problem is totally straightforward. Only possible cause for wrong answer response is if x = y. In that case you should check if x+0.5 > y or not.
Friday, February 17, 2012
Vibes of vi
Well, as a real late bloomer into the Linux distro I've suddenly gotten an urge to use VI. A command based text editor. I started learning it today using the page [ How to use the vi Editor ]. A really nice tutorial to kick it off. At first I thought "Why?? When I have so many good editors that know what a mouse is and have integrated command line support??". The answer came in when I first use the command
cw
It immediately caught my attention, what I could do with it. I could use it in my coding for so many occurrences. Whenever G++ served me with any error, I could search for it using
/ (slash)
And replace it with this command.
I'm currently learning more detailed stuff on this. Hope to replace GUI based IDEs with it someday.
I'm currently learning more detailed stuff on this. Hope to replace GUI based IDEs with it someday.
Command Summary
STARTING vi
vi filename edit a file named "filename" vi newfile create a new file named "newfile"ENTERING TEXT
i insert text left of cursor a append text right of cursorMOVING THE CURSOR
h left one space j down one line k up one line l right one spaceBASIC EDITING
x delete character nx delete n characters X delete character before cursor dw delete word ndw delete n words dd delete line ndd delete n lines D delete characters from cursor to end of line r replace character under cursor cw replace a word ncw replace n words C change text from cursor to end of line o insert blank line below cursor (ready for insertion) O insert blank line above cursor (ready for insertion) J join succeeding line to current cursor line nJ join n succeeding lines to current cursor line u undo last change U restore current lineMOVING AROUND IN A FILE
w forward word by word b backward word by word $ to end of line 0 (zero) to beginning of line H to top line of screen M to middle line of screen L to last line of screen G to last line of file 1G to first line of fileCLOSING AND SAVING A FILEf scroll forward one screen b scroll backward one screen d scroll down one-half screen u scroll up one-half screen n repeat last search in same direction N repeat last search in opposite direction
ZZ save file and then quit :w save file :q! discard changes and quit file
Linux File Manager Launchers
Only recently, I've started to use Ubuntu (Linux Distro FTWDK). After fighting with the kernel night after night and constantly resulting with all sorts of crashes or f-ups, I've finally decided to keep a Windows Dual Boot for my Gaming needs. Wine still isn't in much control yet. Anyway. I finished installing Ubuntu 11.10 and ofcourse, like all the ordinary users I've failed to find my taste in the new Unity desktop. So, I decided to try all the others. I installed XFCE, Gnome, LXDE. Among all of these LXDE acted to be the fastest, though only time will tell because usually my Linux installations end up in begging me to not experiment with them anymore. I kind of liked the idea of having different File Managers. So I collected all of their Launcher strings. Here they are.
Nautilus : nautilus --no-desktop PCMan : exo-open --launch FileManager %u Thunar : thunar /home/username
Storing them for future crashes :P
Subscribe to:
Posts (Atom)
Connect Rapoo MT750S with Linux (Tested on Manjaro)
I bought this obvious copy of MX Master 2S in hopes of having the device switching functionality along with a lightweight body because I ha...
-
I like coding a lot, keeps me glued to the PC for hours. For that reason it's a need to edit the Syntax Highlighter to suit my eyes for...
-
I bought this obvious copy of MX Master 2S in hopes of having the device switching functionality along with a lightweight body because I ha...
-
Install MinGW GCC Port on Windows. 1. Just go to this address [ http://sourceforge.net/projects/mingw/files/Installer/mingw-get-inst/ ]...