1 / 5

11483: Code Creator

11483: Code Creator. ★☆☆☆☆ 題組: Problem Set Archive with Online Judge 題號: 1 1483: Code Creator 解題者: 蔡權昱 解題日期: 200 8 年 9 月 22 日 題意: 題目希望你用程式來寫程式 . 給你 N 行文字 , 你必須用以下輸出可以產生該行文字的程式碼 , 程式碼格式如下 : #include&lt;string.h&gt; #include&lt;stdio.h&gt; int main() { &lt;case specific lines&gt; printf(“<br>”); return 0; }.

Download Presentation

11483: Code Creator

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 11483: Code Creator • ★☆☆☆☆ • 題組:Problem Set Archive with Online Judge • 題號:11483:Code Creator解題者:蔡權昱 • 解題日期:2008年9月22日 • 題意:題目希望你用程式來寫程式. 給你N行文字, 你必須用以下輸出可以產生該行文字的程式碼, 程式碼格式如下:#include<string.h>#include<stdio.h>int main(){<case specific lines>printf(“\n”);return 0;}

  2. 題意範例:Sample input2“I like to solve”I do not like to code1yeah accepted0

  3. 題意範例:Output for Sample InputCase 1:#include<string.h>#include<stdio.h>int main(){printf(“\”I like to solve\”\n”);printf(“I do not like to code\n”);printf(“\n”);return 0;}Case 2:#include<string.h>#include<stdio.h>int main(){printf(“yeah accepted\n”);printf(“\n”);return 0;}

  4. 解法:Simulate 須注意輸出“及\ 之前要多個\,eg.\”or\\以及題目的“ 均為半形” • 解法範例: • #include <iostream> • #include <string> • using namespace std; • int main () { • int n,cn=0; • string str[101],tmp; • while (cin >> n) { • if (n==0) break; • getline(cin,tmp); • for (int i=0; i<n; i++) { • getline(cin,str[i]); • } • cout << "Case " << ++cn << ":\n"; • cout << "#include<string.h>\n#include<stdio.h>\nint main()\n"; • cout << "{\n"; • for (int i=0; i<n; i++) { • cout << "printf(\""; • for (int j=0; j<(int)str[i].length(); j++) { • if (str[i][j] == '\"' || str[i][j]=='\\') { • cout << "\\"; • } • cout << str[i][j]; • } • cout << "\\n\");\n"; • } • cout << "printf(\"\\n\");\n"; • cout << "return 0;\n}\n"; • } • return 0; • }

More Related