513 - NTHUMOOC_I2P2013 Scoreboard

Time

2015/04/30 22:00:26 2015/04/30 22:00:26

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

1000 - The A+B Problem   

Description

Given a,b, output a+b.

Input

a,b<=100000000.

Output

a+b

Sample Input  Download

Sample Output  Download

Tags

4 5 ddd 3 a #include <stdio.h> p klrscpp ? CCY rain orange



Discuss




1801 - reverse number   

Description

輸入一個由 1~9 (不包含 0) 組成的 3 位數,例如 789。

將這個數字順序顛倒 (789 ­> 987),
然後將兩個數目相加 (789+987),
輸出總和 1776。

Input

由 1~9 (不包含 0) 組成的 3 位數

Output

顛倒相加的總和 

Sample Input  Download

Sample Output  Download

Tags




Discuss




1803 - lucky number   

Description

輸入一個由 1~9 (不包含 0) 任意組成的 3 位數,例如 579。

用下列規則開始計算,最後會得出一個幸運數字。
先把相鄰兩個數字加起來,如果相加之後變成二位數(大於 9),
就再加一次讓它變成一位數。
  5   7   9
  |   /  |  /
  3     7           (其中 5 和 7 得到 3 是因為 5+7=12 ­> 1+2=3)
接下來繼續做相同的動作
3   7
 |  /
  1               (3+7=10 ­> 1+0=1)
得到幸運數字 1

Input

一個由 1~9 (不包含 0) 任意組成的 3 位數

Output

對應的幸運數字

Sample Input  Download

Sample Output  Download

Tags




Discuss




1805 - Run-Length Encoding   

Description

修改下面的程式片段
讓它能夠計算使用者輸入的連續英文字母個數 
(類似 Run-Length Encoding, http://en.wikipedia.org/wiki/Run-length_encoding)
輸入的字元只會有小寫英文字母和空格(' ') 或換行 ('
')
輸入的結尾是 '#' 字元

例如:
輸入 
    aa bbb b c dd a a aa#
輸出
    a2b4c1d2a4

或是輸入
    cccc cc
    cc ddd xx xii #
輸出
    c8d3x3i2


底下的程式樣本
ch 用來記住剛讀取到字元
prev 用來記住目前為止的連續字元
count 則是記錄連續的次數
只要在 /* your code */ 的地方加入你的程式碼
就能夠完成這項作業

[提示]
1. 如果剛讀取到的字元是 ' ' '
' 就忽略
2. 如果剛讀取到的字元和目前連續的字元相同,只需要增加 count
3. 如果剛讀取到的字元和目前連續的字元不同,要重設相關的變數

----------------

/*
ps2_1.c
Input:
    aa bbb b c dd a a aa#
Output:
    a2b4c1d2a4
Input:
    cccc cc    cc ddd xx xii #
Output:
    c8d3x3i2
*/
#include 
int main(void)
{
    int ch;
    int prev = 0;
    int count = 0;

    while ((ch=getchar())!='#') {
        /* your code */
    }
    /* your code */

    return 0;
}




 

Input

參照題目敘述

Output

參照題目敘述

Sample Input  Download

Sample Output  Download

Tags




Discuss




1807 - Arrowhead matrix   

Description

[ps2_2]

輸入介於 2 20 的整數代表矩陣大小
輸出對應大小的 Arrowhead matrix
http://en.wikipedia.org/wiki/Arrowhead_matrix

例如
輸入:
5

輸出:
 * * * * *
 * * 0 0 0
 * 0 * 0 0
 * 0 0 * 0
 * 0 0 0 *

底下是樣本程式


/*
ps2_2.c
Arrowhead matrix
http://en.wikipedia.org/wiki/Arrowhead_matrix

Input:
3

Output:
 * * *
 * * 0
 * 0 *

*/
#include 
int main(void)
{
    int n;
    int i, j;
    scanf("%d", &n);

    /* your code */

    return 0;
}

Input

參照題目敘述

Output

參照題目敘述

Sample Input  Download

Sample Output  Download

Tags




Discuss




1809 - string matching   

Description

[ps2_3]

輸入兩個正整數 a b 而且 a 一定大於 b
找出 b 的數字在 a 中出現的次數
例如
輸入:
    781348781346891346 134
輸出:
    3

因為 781348781346891346 當中總共出現 3 134

[提示]
1.可以先用一個迴圈
算出比 b 高一位的 10 的倍數 
並將這個數目存為 r
譬如 b 134 r 1000

2.接下來再用另一個迴圈
r a 的餘數與 b 比較看看是否相等
每次比完之後
就將 a 的位數降一位
繼續做下一次迴圈
直到 a 的位數都用完為止

底下是樣本程式
使用 unsigned long long 是為了能夠讀取將近 20 位數的正整數
測試時
我們會假設輸入的正整數最多只有 18 位數

/*
ps2_3.c

Input:
781348781346891346 134

Output:
3

Input:
71349999134997 99

Output:
4
*/
#include 
int main(void)
{
    unsigned long long a, b;
    unsigned long long r;
    int count = 0;

    scanf("%llu%llu", &a, &b);

    /* your code */

    printf("%d
", count);

    return 0;
}

Input

參照題目敘述

Output

參照題目敘述

Sample Input  Download

Sample Output  Download

Tags




Discuss




1811 - zuma--insert   

Description

完成 ps3_1.c 其中的 insert 函數

Input

Output

Sample Input  Download

Sample Output  Download

Tags




Discuss




1812 - zuma--RLE   

Description

完成 ps3_2.c 其中的 count 函數

Input

Output

Sample Input  Download

Sample Output  Download

Tags




Discuss




1813 - zuma--collapse   

Description

Input

Output

Sample Input  Download

Sample Output  Download

Tags




Discuss




1814 - Prefix   

Description

 

Input

Output

Sample Input  Download

Sample Output  Download

Tags




Discuss




1815 - Mask (binary)   

Description

Input

Output

Sample Input  Download

Sample Output  Download

Tags




Discuss




1816 - Jewels   

Description

 車子吃寶物遊戲

Input

Output

Sample Input  Download

Sample Output  Download

Tags




Discuss




1818 - Dictionary Search   

Description

 搜尋字典的單字

Input

Output

Sample Input  Download

Sample Output  Download

Tags




Discuss




1820 - Advanced Dictionary Search   

Description

 從字典中找出單字是使用者輸入字串的任意排列 (不論大小寫)

Input

Output

Sample Input  Download

Sample Output  Download

Tags




Discuss




1821 - Linked List I   

Description

  輸入將會有多筆資料以及多個指令。一筆資料存在一個 node 中,新的資料插在 list 的最前端。指令只有 RA 一種,它代表 reversal duplication + appending。產生一個目前 list 的反序複製本,並將它接在目前 list 的後面形成一個更長的 list。輸出讀完資料後的 list,以及做完所有指令後的 list。

Input

資料筆數 n
接下來 n 行,一行一筆資料,可能是浮點數或是字串,字串最多 20 個字元
指令數 m
接下來 m 行,一行一個指令

Output

讀完資料後的 list,資料以空白隔開
做完所有指令的 list,資料以空白隔開

Sample Input  Download

Sample Output  Download

Tags




Discuss




1822 - Linked List II   

Description

  承 1821 題,指令多了 DA,它代表 duplication + appending。產生一個目前 list 的複製本,並將它接在目前 list 的後面形成一個更長的 list。

Input

資料筆數 n
接下來 n 行,一行一筆資料,可能是浮點數或是字串,字串最多 20 個字元
指令數 m
接下來 m 行,一行一個指令

Output

讀完資料後的 list,資料以空白隔開
做完所有指令的 list,資料以空白隔開

Sample Input  Download

Sample Output  Download

Tags




Discuss




1823 - Quicksort I   

Description

  輸入將會有多筆產品資料,包括產品名稱、價格、賣家評價。以及多個搜尋產品名稱的字串,搜尋字串可能只包含產品名稱的開頭。先印出查詢的字串,接著找出所有名稱開頭相符的產品(忽略大小寫),並印出產品的詳細資料。順序由低價到高價,若價格相同,則依照賣家評價,由高到低排序。每一筆查詢都至少會有一個結果。

Input

產品資料筆數 n
接下來 3n 行關於產品的描述,每一個產品描述有 3 行:
產品名稱(字串)
產品價格(整數)
賣家評價(浮點數)
查詢數 m
接下來 m 行,每一行一個查詢字串

Output

m 個查詢結果,每一個包含:
查詢字串
查詢到的產品,一行一個產品

Sample Input  Download

Sample Output  Download

Tags




Discuss




1824 - Quicksort II   

Description

  承 1823 題。查詢方式改為查詢某個價位間的產品。印出價格的區間,接著找出價格落在這區間的產品,並印出產品詳細資料。依照產品名稱排序(考慮大小寫),名稱相同,則依照價格由低到高排序,價格相同,則由高評價排到低評價。

Input

產品資料筆數 n
接下來 3n 行關於產品的描述,每一個產品描述有 3 行:
產品名稱(字串)
產品價格(整數)
賣家評價(浮點數)
查詢數 m
接下來 m 行,每一行 2 個整數,代表最低價位、最高價位

Output

m 個查詢結果,每一個包含:
最低價位<=price<=最高價位
查詢到的產品,一行一個產品

Sample Input  Download

Sample Output  Download

Tags




Discuss




1825 - Matrix Multiplication   

Description

請寫一個程式可以做出兩個矩陣相乘。
其中 Input 矩陣的元素都是整數,而矩陣大小不會超過 50x50 (最小為 1x1)

Input

三個數字,用空白隔開(第一個數字是第一個矩陣的列數(rows);第二個數字是第一個矩陣的行數(columns)(也是第二個矩陣的列數);第三個數字是第二個矩陣的行數) 
第一個矩陣(數字間都用一個空白隔開)
第二個矩陣(數字間都用一個空白隔開)

Output

計算後的結果,矩陣中每列(row)中的每個數字請用一個空白隔開,且每列最後沒有多餘空白字元(輸出結果最後有換行)

Sample Input  Download

Sample Output  Download

Tags




Discuss




1828 - N Queens   

Description

在一個 n x n 的棋盤上放 n 個皇后,指定某個位置一定要放皇后,且任兩個皇后不能在同一水平、垂直或斜對角線上。輸出有幾種合法的放法。

Input

不大於 10 的正整數 n,表示在 n x n 的棋盤上放置 n 個皇后
不大於 n 的正整數 a 和 b,以空白隔開,即第 a 橫列和第 b 縱行一定要放皇后

Output

有幾種放法,記得換行

Sample Input  Download

Sample Output  Download

Tags

hello world!



Discuss




1830 - Bulls and Cows   

Description

輸入一個三位正整數以及 ?A?B 的資訊,然後輸出所有可能的答案。
三位數的開頭不會是 0 而且數字不會重覆。
Sample Input 第一個數字 123 是猜測的數字,接下來兩個數字 1 和 2 分別表示 1A 和 2B,也就是 123 和正確答案相比,有一個數字的位置完全相同,但是有兩個數字的位置錯誤。你的程式要能夠由小到大輸出符合 1A2B 條件的所有可能的正確答案,也就是 Sample Output 的結果。

Input

猜的數字
兩個數字(分別是 ?A 和 ?B)

Output

所有可能的正確答案(從小排到大)
最後有換行

Sample Input  Download

Sample Output  Download

Tags




Discuss




1832 - Chess Fun   

Description

輸入一個棋盤,找出分數最高的棋子放置的方式。
放置的棋子形狀只有底下這一種,但可以旋轉四個方向。

以Sample Input來說,分數最高的放置方法像底下這樣:

所以應該要輸出 13

Input

固定大小 4x4 的二維陣列,代表可用來放置的棋盤,棋盤格中的整數代表分數

Output

找出分數最高的放置方法,輸出最高能夠得的分數
最後記得換行

Sample Input  Download

Sample Output  Download

Tags




Discuss




1834 - Numbers Tower   

Description

有一座數字塔,裡面包含許多整數,呈三角形,如下面的範例:
    1
   4 6
  6 9 3
 6 3 7 1
2 6 3 1 8
第一層 1 個數字,第二層 2 個數字,以此類推。從最上層走到最底層,每一步都一定要往下走,而且只有鄰近的左右兩條路可以選,例如第二層的 4 只能走到第三層的 6 或 9。將經過的數字加總,代表該路徑的值。請找出所有路徑中最大的值,並將該值輸出。

Input

不大於 10 的正整數 n,代表塔的高度
接下來 n 行,一行代表一層的數字,數字以空白隔開

Output

可能路徑的最大值,記得換行

Sample Input  Download

Sample Output  Download

Tags




Discuss