@@ -25,6 +25,7 @@ def get_problem_info(workbook_url):
2525  ret  =  []
2626  while  True :
2727    x  =  txt .find (pattern )
28+     print (x )
2829    if  x  ==  - 1 : break 
2930    txt  =  txt [x + 9 :]
3031    prob_id , prob_name  =  '' , '' 
@@ -42,19 +43,12 @@ def get_problem_info(workbook_url):
4243
4344CATEGORY  =  ["연습 문제" , "기본 문제✔" , "기본 문제" , "응용 문제✔" , "응용 문제" ]
4445
45- # gen 0x00.md to 0x??.md, proper prob_id.cpp  for each solution directory 
46+ # gen 0x00.md to 0x??.md, proper prob_id.java  for each solution directory 
4647def  gen_ind_workbook (attrs , category ):
4748  txt  =  '''// Authored by : BaaaaaaaaaaarkingDog 
4849// Co-authored by : - 
4950// http://boj.kr/**************** 
50- #include <bits/stdc++.h> 
51- using namespace std; 
52- 
53- int main(void){ 
54-   ios::sync_with_stdio(0); 
55-   cin.tie(0); 
56-    
57- }''' 
51+ ''' 
5852  chapter_idx  =  0 
5953  for  attr  in  attrs :
6054    if  len (attr ) <  3 : # No workbook 
@@ -69,24 +63,24 @@ def gen_ind_workbook(attrs, category):
6963      if  prob_id  in  category [chapter_idx ]:
7064        category_idx  =  category [chapter_idx ].index (prob_id )
7165      file_path  =  solution_path  +  prob_id 
72-       if  not  os .path .exists (file_path  +  '.cpp ' ):
73-         with  open (file_path  +  '.cpp ' , 'w' , encoding = "UTF-8" ) as  f :
66+       if  not  os .path .exists (file_path  +  '.java ' ):
67+         with  open (file_path  +  '.java ' , 'w' , encoding = "UTF-8" ) as  f :
7468          f .write (txt )
7569      try :
76-         codes  =  open (file_path  +  '.cpp ' , 'r' , encoding = "UTF-8" ).read ()
70+         codes  =  open (file_path  +  '.java ' , 'r' , encoding = "UTF-8" ).read ()
7771      except : # EUC-KR -> UTF-8 
78-         codes  =  open (file_path  +  '.cpp ' , 'r' , encoding = "EUC-KR" ).read ()
79-         with  open (file_path  +  '.cpp ' , 'w' , encoding = "UTF-8" ) as  fw :
72+         codes  =  open (file_path  +  '.java ' , 'r' , encoding = "EUC-KR" ).read ()
73+         with  open (file_path  +  '.java ' , 'w' , encoding = "UTF-8" ) as  fw :
8074          fw .write (codes )
8175      if  codes [:100 ] ==  txt [:100 ]:
8276        prob_table  +=  f'| { CATEGORY [category_idx ]} { prob_id } { prob_name } { prob_id } \n ' 
8377      else :
8478        solution_num  +=  1 
85-         code_attr  =  f'[정답 코드]({ file_path .replace (" " , "%20" )} cpp )' 
79+         code_attr  =  f'[정답 코드]({ file_path .replace (" " , "%20" )} java )' 
8680        MAX_DIFFERENT_SOLUTION  =  9 
8781        for  i  in  range (1 , MAX_DIFFERENT_SOLUTION + 1 ):
88-           if  os .path .exists (file_path + '_' + str (i )+ '.cpp ' ):
89-             code_attr  +=  f", [별해 { i } { file_path + '_' + str (i )+ '.cpp ' }  
82+           if  os .path .exists (file_path + '_' + str (i )+ '.java ' ):
83+             code_attr  +=  f", [별해 { i } { file_path + '_' + str (i )+ '.java ' }  
9084        prob_table  +=  f'| { CATEGORY [category_idx ]} { prob_id } { prob_name } { prob_id } { code_attr } \n ' 
9185    with  open (attr [0 ]+ '.md' , 'w' , encoding = "UTF-8" ) as  f :
9286      # progress bar 
0 commit comments