[#Codeforces] I_love_%username%

ตั้งแต่ข้อนี้เป็นต้นไปผมย้ายมาเขียนที่ Python 3 แล้วนะครับ

ข้อนี้ input list คะแนนเข้ามาให้หาว่า มีครั้งที่ได้คะแนนมากสุดหรือน้อยที่สุดกี่ครั้ง นับจากลำดับการ input

I_love_%username%

Vasya adores sport programming. He can’t write programs but he loves to watch the contests’ progress. Vasya even has a favorite coder and Vasya pays special attention to him.

One day Vasya decided to collect the results of all contests where his favorite coder participated and track the progress of his coolness. For each contest where this coder participated, he wrote out a single non-negative number — the number of points his favorite coder earned in the contest. Vasya wrote out the points for the contest in the order, in which the contests run (naturally, no two contests ran simultaneously).

Vasya considers a coder’s performance in a contest amazing in two situations: he can break either his best or his worst performance record. First, it is amazing if during the contest the coder earns strictly more points that he earned on each past contest. Second, it is amazing if during the contest the coder earns strictly less points that he earned on each past contest. A coder’s first contest isn’t considered amazing. Now he wants to count the number of amazing performances the coder had throughout his whole history of participating in contests. But the list of earned points turned out long and Vasya can’t code… That’s why he asks you to help him.

RaspberryPi ลง Package จาก gem install ไม่ได้

วิธีการแก้ปัญหาลง package ของ ruby ด้วย gem ไม่ได้นะครับ..

ต้องใช้ amazon s3 bucket ครับ

ตอนลงก็ให้ใส่ว่า..
$ gem install rails –source http://production.cf.rubygems.org/

แต่ถ้าต้องการ Add source นี้เอาไว้เลย ก็ให้ใส่
$ gem sources -a http://production.cf.rubygems.org/

คราวหน้าก็สั่ง $ gem install rails

ขอบคุณ NAzT’s Blog สำหรับคำแนะนำครับ

[#codeforces] Chat room

ลองเปลี่ยนมาเขียน Ruby ดูบ้าง
ข้อนี้ให้โจทย์รับ string มาค่านึงแล้วให้หาว่าค่าที่รับมาเนี่ย มันต่อกันเป็นคำว่า hello มั้ยเมื่อตัดตัวซ้ำออกแล้ว เช่น (ahhhhhheeeeeellllloo == hello) แต่ (hlelo != hello)

Chat room

 

[#codeforces] Present from Lena

ข้อนี้ก็ปรินท์ค่าออกไปตามโจทย์เลยครับ ห่าง code ไปหลายวันเขียนข้อนี้แล้ว code มันแปลกมากๆ เดี๋ยวเอาไว้ refactor ทีเดียวละกัน

Present from Lena

[#codeforces] Amusing Joke

โจทย์ก็รับ string 3 ตัว โดยตัวที่ 1+2 เนี่ยต้องใช้ตัวที่ 3 เขียนได้จนครบพอดี (ตัวที่ 3 ไม่เหลือ)

  • สงสัยอยู่ว่าทำไมเช็ค count==len(z) อย่างเดียวไม่ได้มันรันไม่ผ่านเลย check เพิ่มอีกตัว

Amusing Joke

[#codeforces] Beautiful Matrix

ตารางมันไม่สวยครับ การที่จะสวยได้ต้องเอาเลข 1 ไปไว้ตรงกลาง ทีนี้เค้าเลยถามว่าต้องเดินกี่ก้าวถึงจะถึงตรงกลาง

Beautiful Matrix

[#codeforces] Boy or Girl

ข้อนี้ให้ตรวจสอบชื่อครับว่าเป็นเลขคี่หรือเลขคู่ ตัวโจทย์ก็ตลกๆดีตามสถานการณ์ในสมัยนี้ lol

  • ช่วงนี้รู้สึกไม่อยาก Blog มากเพราะเวลาเขียนโปรแกรมน้อยเลยมีแต่ข้อง่ายๆ T__T

Boy or Girl

[#Codeforces] Queue at the School

ในโรงเรียนแห่งนึงครับเด็กต่อแถวกันเพื่อจะเข้าไปโรงอาหารก็จะมีเด็กผู้ชายเด็กผู้หญิงต่อแถวกันทีนี้เด็กผู้ชายมันเกิดอึดอัดเวลามีผู้หญิงมาต่อท้าย ก็เลยปล่อยให้ผู้หญิงแซงไปอยู่ด้านหน้า
ทีนี้เวลา n วินาทีจะแซงได้ n ครั้งให้หารูปแบบแถวหลังจากแซงไป n ครั้งว่าเป็นยังไง

ปล.ตอนนี้หันมาโฟกัสที่ Python อย่างเดียว แต่เดี๋ยวหาเวลาว่างไปเขียน #1S4L ต่อแน่ครับ

Queue at the School