GithubHelp home page GithubHelp logo

zhblue / freeproblemset Goto Github PK

View Code? Open in Web Editor NEW
180.0 15.0 58.0 32.4 MB

freeproblemset is a standard for acm-icpc contest problem storage in xml

License: GNU Lesser General Public License v3.0

C# 58.35% Smarty 5.47% Java 25.80% HTML 2.02% Python 6.60% C 1.72% Makefile 0.04%
hustoj acm problemset fps icpc-online-judge

freeproblemset's People

Contributors

azure99 avatar hulang-btb avatar virusdefender avatar william-song-shy avatar zhblue avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

freeproblemset's Issues

ruby写的命令行小工具

#!/usr/bin/env ruby

require "set"
require "rexml/parsers/sax2parser"

module FPSParser

  def self.default_tpl(problem)
    return <<EOF
<!doctype html>
<html>
  <head>
    <meta charset="UTF-8"/>
    <title>#{problem.title}</title>
    <style>
     p img {
       vertical-align: -webkit-baseline-middle
     }
    </style>
  </head>
  <body>
    <h1>#{problem.title}</h1>
    <div>
      <span>Time Limit: </span>#{problem.time_limit} Sec
      &nbsp;&nbsp;
      <span>Memory Limit: </span>#{problem.memory_limit} MB
    </div>

    <h2>Description</h2>
    <div>#{problem.description}</div>
    <h2>Input</h2>
    <div>#{problem.input}</div>
    <h2>Output</h2>
    <div>#{problem.output}</div>
    <h2>Sample Input</h2>
    <div><pre>#{problem.sample_input}</pre></div>
    <h2>Sample output</h2>
    <div><pre>#{problem.sample_output}</pre></div>
    <h2>Source</h2>
    <div>#{problem.source}</div>
    <h2>Hint</h2>
    <div>#{problem.hint}</div>
  </body>
</html>
EOF
  end

  def self.parse(fname)
    problem, imgs, imgs_key = nil, nil, nil
    parser = REXML::Parsers::SAX2Parser.new(File.new(fname))

    parser.listen(:start_element, ['item']) do
      problem = Problem.new
      imgs = Hash.new
    end

    Problem.attr_names.each do |key|
      key = key.to_s
      parser.listen(:cdata, [key]) do |content|
        problem[key] = content
      end
    end

    parser.listen(:cdata, ['src', 'img']) do |content|
      imgs_key = content
    end
    parser.listen(:cdata, ['base64', 'img']) do |content|
      imgs[imgs_key] = content
    end

    parser.listen(:end_element, ['item']) do
      imgs.each do |key, val|
        problem.description.gsub!(key, "data:image/png;base64,#{val}") if problem.description
        problem.input.gsub!(key, "data:image/png;base64,#{val}") if problem.input
        problem.output.gsub!(key, "data:image/png;base64,#{val}") if problem.output
      end
      yield problem
    end
    parser.parse
  end

  class Problem

    @@attr_names = Set.new [:title, :time_limit, :memory_limit,
                            :description, :input, :output, :source,
                            :hint, :sample_input, :sample_output,
                            :test_input, :test_output]

    def self.attr_names
      @@attr_names
    end

    attr_reader :attr

    def initialize
      @attr = {}
    end

    def []=(key, val)
      key_check(key)
      @attr[key.to_sym] = val
    end

    def [](key)
      key_check(key)
      @attr[key.to_sym]
    end

    def method_missing(m, *args, &block)
      if m.to_s.end_with? '='
        self[m[0...-1]] = args[0]
      else
        self[m]
      end
    end

    def to_s
      @attr.to_s
    end

    private
    def key_check(key)
      raise "Unsupported key name: #{key}" unless @@attr_names.include? key.to_sym
    end
  end

end

if __FILE__ == $0
  require 'optparse'

  options = {}
  OptionParser.new do |opts|
    opts.banner = "Usage: #{$0} [options] FPS_FILE ..."
  end.parse!

  ARGV.each do |fname|
    prefix = fname[0...-(File::extname fname).length]
    pid = 0
    FPSParser::parse(fname) do |p|
      html = FPSParser::default_tpl(p)
      pids = pid.to_s.rjust(4, '0')
      File.open("#{prefix}-p#{pids}.html", 'w') {|f| f.write(html)}
      File.open("#{prefix}-p#{pids}.input", 'w') {|f| f.write(p.test_input)}
      File.open("#{prefix}-p#{pids}.output", 'w') {|f| f.write(p.test_output)}
      pid += 1
    end
  end
end

关于数学公式渲染

您好,我通过tk题库的链接下载,题目里的由$包裹的数学公式无法渲染
It's bug?Or it's feature

SetMessage无法 使用

为什么使用了LIVECD 安装的OJ ,SetMessage无法 修改 
,每次修改自动恢复初始状态的 IDE测试 字样 。


Original issue reported on code.google.com by [email protected] on 24 Jan 2014 at 1:31

Web Board 不能发贴

提示:
Field 'ip' doesn't have a default value

Original issue reported on code.google.com by Sevkme on 16 Jan 2011 at 7:08

请问大家都是怎么制作fps的?

原先每道题有10个测试点和txt格式的描述。请问怎样快速、批
量制作成xml的试题?希望大家帮助一下。问题解决后,我一��
�会把做好的题目发上来的。

Original issue reported on code.google.com by litimetal on 2 Jun 2012 at 1:41

1054 题,找不到输入的行数

输入应该是几行? 或者连续输入2个空行算是输入结束也行.
但是那题没有输入行数定义 . 也没有指定从哪个文件输入.

Original issue reported on code.google.com by Sevkme on 8 Jan 2011 at 1:04

怎么将poj的题目导出为fps呢?难道要自己写导出工具吗?

您好,我校原来用的是poj,最近想换成hustoj 
,原来的poj上有好多题目,本来看了这篇文章http://code.google.c
om/p/hustoj/wiki/POJ2HUSTOJ,按照上面说的步骤操作了,题目能出��
�了,但在提交时就没反应了,看了下数据库中的表少了好几�
��,结果又重新装了一遍,这次不想再按照那个步骤操作了,
只想把poj的题目导出为fps格式的文件,有什么快捷的办法吗��
�是不是还要我自己写一个数据库导出fps工具?有没有现成的�
��具软件做这个?       

Original issue reported on code.google.com by [email protected] on 4 Oct 2013 at 4:58

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.