diff --git a/fps/fps.xml b/fps/fps.xml
new file mode 100644
index 00000000..55c0936e
--- /dev/null
+++ b/fps/fps.xml
@@ -0,0 +1,145 @@
+
+
+
+ -
+
+
+
+
+
]]>
+
+ Two integer a,b (0<=a,b<=10)
+
]]>
+
+
+
+
+
+
+
+
+
+
+int main()
+{
+ int a,b;
+ while(scanf("%d%d",&a,&b)!=EOF)
+ {
+ printf("%d\n",a+b);
+ }
+ return 0;
+}]]>
+
+
+int main()
+{
+ int a,b;
+ scanf("%d %d",&a,&b);
+ printf("%d",a+b);
+ return 0;
+}
+]]>
+
+#include
+using namespace std;
+int main()
+{
+#ifndef ONLINE_JUDGE
+ freopen("in.txt","r",stdin);
+#endif
+ int a,b;
+ while(cin >>a >>b)
+ {
+ cout <
+
+using namespace std;
+int main(){
+ int a,b;
+ while(cin >> a >> b)
+ cout << a+b << endl;
+ return 0;
+}
+]]>
+
+
+
+
+
+
+
+int main()
+{
+ int a,b;
+ scanf("%d %d",&a,&b);
+ printf("%d",a+b);
+ return 0;
+}
+]]>
+
+using namespace std;
+int main(){
+ int a,b;
+ while(cin >> a >> b)
+ cout << a+b << endl;
+ return 0;
+}
+]]>
+
+
diff --git a/fps/parser.py b/fps/parser.py
index 7f2bf3dd..369a5824 100644
--- a/fps/parser.py
+++ b/fps/parser.py
@@ -15,7 +15,7 @@ class FPSParser(object):
def root(self):
if self._root is None:
self._root = ET.ElementTree(file=self.path).getroot()
- if self._root.attrib["version"] != "1.0":
+ if self._root.attrib["version"] != "1.2":
raise ValueError("Unsupported version")
return self._root
@@ -24,8 +24,9 @@ class FPSParser(object):
"memory_limit": {"unit": None, "value": None},
"time_limit": {"unit": None, "value": None},
"images": [], "input": None, "output": None, "samples": [],
+ "append": [], "template": [], "prepend": [],
"test_cases": [], "hint": None, "source": None,
- "spj": None, "solution": None}
+ "spj": [], "solution": []}
sample_start = True
test_case_start = True
for node in self.root:
@@ -52,6 +53,11 @@ class FPSParser(object):
if value <= 0:
raise ValueError("Invalid memory limit value")
problem["memory_limit"]["value"] = value
+ elif tag in ["template", "append", "prepend", "solution", "spj"]:
+ lang = item.attrib.get("language")
+ if not lang:
+ raise ValueError("Invalid " + tag + ", language name is missed")
+ problem[tag].append({"language": lang, "code": item.text})
elif tag == "img":
problem["images"].append({"src": None, "blob": None})
for child in item:
@@ -116,6 +122,8 @@ class FPSParser(object):
if __name__ == "__main__":
+ import pprint
parser = FPSParser("fps.xml")
- parser.save_image("/tmp", "/static/img")
+ parser.parse()
+ pprint.pprint(parser.save_image("/tmp", "/static/img"))
parser.save_test_case("/tmp")