# 114 程式設計實習I (資訊一乙) Week08 回家作業 password:weekhw08888 ## 1. Calculate Money in FCU Bank ### 題目敘述 Hercy wants to save money for his first car. He puts money in the FCU bank every day. He starts by putting in $1 on Monday, the first day. Every day from Tuesday to Sunday, he will put in $1 more than the day before. On every subsequent Monday, he will put in $1 more than the previous Monday. Given n, return the total amount of money he will have in the FCU bank at the end of the nth day. --- ### 題目輸入 Multiple test cases, each containing a single integer n (1 ≤ n ≤ 1000), representing the nth day.The program terminates when n = 0. --- ### 題目輸出 For each test case, output a single integer representing the total amount of money Hercy will have in the FCU bank at the end of the nth day. --- ### 範例輸入1 ``` 4 10 20 0 ``` ### 範例輸出1 ``` 10 37 96 ``` ## 2. Score ### 題目敘述 There is an objective test result such as “OOXXOXXOOO”. An ‘O’ means a correct answer of a problem and an ‘X’ means a wrong answer. The score of each problem of this test is calculated by itself and its just previous consecutive ‘O’s only when the answer is correct. For example, the score of the 10th problem is 3 that is obtained by itself and its two previous consecutive ‘O’s. Therefore, the score of “OOXXOXXOOO” is 10 which is calculated by “1+2+0+0+1+0+0+1+2+3”. You are to write a program calculating the scores of test results. --- ### 題目輸入 Your program is to read from standard input. The input consists of T test cases. The number of test cases T is given in the first line of the input. Each test case starts with a line containing a string composed by ‘O’ and ‘X’ and the length of the string is more than 0 and less than 80. There is no spaces between ‘O’ and ‘X’. --- ### 題目輸出 Your program is to write to standard output. Print exactly one line for each test case. The line is to contain the score of the test case. --- ### 範例輸入1 ``` 5 OOXXOXXOOO OOXXOOXXOO OXOXOXOXOXOXOX OOOOOOOOOO OOOOXOOOOXOOOOX ``` ### 範例輸出1 ``` 10 9 7 55 30 ``` ## 作業繳交方式 Assignment Submission Instructions * 交至ilearn作業繳交區 * 原始碼檔名以 學號_題號.c 命名 (example. D1109070_01.c, D1109070_02.c) * 分爲兩個檔案上傳(限定 C 語言) * [作業網址](https://oj.fcu.edu.tw/contest/1484)