相關數問題

2021-10-05 18:24:54 字數 762 閱讀 9123

/*description

有一組10-99之間的整數,輸出所有與指定數x相關的數。所謂相關數,以7為例,是那些個位上或十位上包含7,或能被7整除的數。

input

測試資料有多組,第1行的數t表示測試資料的組數。每組資料報含3行,第1行是正整數n,表示第2行有n個10-99之間的數,第3行是指定數x(3、5或7)。

output

對於每組測試資料,輸出所有與指定數相關的相關數,每個數單獨佔一行。若沒有相關數,則什麼也不輸出。

sample input28

45 36 70 84 66 25 62 7935

45 60 24 28 53

7sample output

4536

8466

28*/

#include

#include

#define n 10

typedef

struct lnode

*linklist,lnode;

intmain()

scanf

("%d"

,&p1->b);if

(i ==

0) head = p1;

else p2->next = p1;

p2 = p1;

} p2->next =

null

;while

(head)

head = head->next;

}}

卡特蘭數相關問題

卡特蘭數 規定c0 1,而c1 1,c2 2,c3 5,c4 14,c5 42,c6 132,c7 429,c8 1430,c9 4862,c10 16796,c11 58786,c12 208012,c13 742900,c14 2674440,c15 9694845 公式為cn c 2n,n n...

ORACLE 隨機數相關問題

1.隨機數包 select dbms random.value from dual 2.在 0.100 範圍內取隨機數 select trunc dbms random.value 0,100 from dual 3.大於字元 a 的10個字元隨機字串 select dbms random.stri...

卡特蘭數(Catalan)相關問題

cn 2n c n 12 n 1n 1cn 2n假設有n對左右括號,請求出合法的排列有多少個?合法是指每乙個括號都可以找到與之配對的括號,比如n 1時,是合法的,但是 為不合法。給定乙個整數n,請返回所求的合法排列數。保證結果在int範圍內。2n個人排隊買票,n個人拿5塊錢,n個人拿10塊錢,票價是...