๋ฌธ์ œ

https://www.acmicpc.net/problem/5565

์„ค๋ช…

์ฑ… 9 ๊ถŒ์˜ ๊ฐ€๊ฒฉ์ด ๊ฐ๊ฐ ์ฃผ์–ด์ง€๊ณ  ์ฑ… 10 ๊ถŒ์˜ ์ด ๊ฐ€๊ฒฉ์ด ์ฃผ์–ด์ง€๋ฏ€๋กœ ์ด๊ฐ€๊ฒฉ์„ tot๋ณ€์ˆ˜์— ์ €์žฅํ•˜๊ณ  ๋‚˜๋จธ์ง€ ์ฑ…๋“ค์˜ ๊ฐ€๊ฒฉ์„ mod๋ณ€์ˆ˜์— for๋ฌธ์„ ์ด์šฉํ•ด 9 ๋ฒˆ ๋ฐ˜๋ณต์‹œ์ผœ ๋”ํ•˜๋„๋ก ํ•˜๊ณ  ๊ฒฐ๊ณผ๋กœ tot-mod ๋ฅผ ์ถœ๋ ฅํ•˜๋„๋ก ํ•˜์˜€๋‹ค.

์ฝ”๋“œ

#include <stdio.h>

int main() {
    int tot,mod=0;
    scanf("%d",&tot);
    for (int i=0; i<9; i++)
    {
        int temp;
        scanf("%d",&temp);
        mod += temp;
    }
    printf("%d",tot-mod);
    
    return 0;
}