VioletaBabel

14551번: Card Game Contest 본문

백준/백준-C
14551번: Card Game Contest
Beabletoet 2017. 5. 21. 20:12

#include <stdio.h>

int main()

{

int n, m, num = 1;

scanf("%d %d", &n, &m);

for (int i = 0, temp; i < n; ++i)

{

scanf("%d", &temp);

temp = (temp == 0) ? 1 : temp;

num = (num * temp) % m;

}

printf("%d", num%m);

}

'백준 > 백준-C' 카테고리의 다른 글

14584번: 암호 해독  (0) 2017.05.21
14582번: 오늘도 졌다  (0) 2017.05.20
1075번: 나누기  (0) 2017.05.20
2607번: 비슷한 단어  (0) 2017.05.16
9426번: 중앙값 측정 (실패)  (0) 2017.05.15
Comments