Class: AOJ::Problem
- Inherits:
-
Object
- Object
- AOJ::Problem
- Defined in:
- lib/aoj/problem.rb
Constant Summary collapse
- ICPC_VOLUMES =
[ '10', '11', '12', '13', '20', '21', '22', '23', '24', '25', '26' ].freeze
Instance Attribute Summary collapse
-
#available ⇒ Object
Returns the value of attribute available.
-
#id ⇒ Object
Returns the value of attribute id.
-
#memory_limit ⇒ Object
Returns the value of attribute memory_limit.
-
#name ⇒ Object
Returns the value of attribute name.
-
#time_limit ⇒ Object
Returns the value of attribute time_limit.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#available ⇒ Object
Returns the value of attribute available.
3 4 5 |
# File 'lib/aoj/problem.rb', line 3 def available @available end |
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'lib/aoj/problem.rb', line 3 def id @id end |
#memory_limit ⇒ Object
Returns the value of attribute memory_limit.
3 4 5 |
# File 'lib/aoj/problem.rb', line 3 def memory_limit @memory_limit end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/aoj/problem.rb', line 3 def name @name end |
#time_limit ⇒ Object
Returns the value of attribute time_limit.
3 4 5 |
# File 'lib/aoj/problem.rb', line 3 def time_limit @time_limit end |
Class Method Details
.random_icpc(user_id) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/aoj/problem.rb', line 16 def random_icpc(user_id) volumes = ICPC_VOLUMES solved_ids = AOJ::API.user(user_id)[:solved_list].map { |s| s[:id] } volumes.shuffle.each do |volume| problem_list = AOJ::API.problem_list(volume).map { |e| e[:id] } - solved_ids unless problem_list.empty? problem_id = problem_list.sample return AOJ::API.problem_search(problem_id) end end raise AOJ::Error::NoProblemLeftError end |
Instance Method Details
#url ⇒ Object
5 6 7 8 9 |
# File 'lib/aoj/problem.rb', line 5 def url base_url = "http://judge.u-aizu.ac.jp/onlinejudge/description.jsp" params = { "id" => id } base_url + "?" + params.to_query end |