๋ฌธ์
https://www.acmicpc.net/problem/10833
์ค๋ช
๊ทธ๋ฅ ์ฌ๊ณผ๋ฅผ ํ์๋ค์๊ฒ ๋๋ ์ฃผ๊ณ ๋จ์ ์ฌ๊ณผ์ ์ดํฉ์ ๊ตฌํ๋ ๊ฒ ์ด๋ฏ๋ก ๊ทธ๋ฅ mod(%)๋ฅผ ์ด์ฉํด ๋๋จธ์ง๋ฅผ ๊ตฌํด ๋ชจ๋ ๋ํด ์ถ๋ ฅํ๋๋ก ํ๋ฉด ๋์ด๋ค.
์ฝ๋
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main()
{
int t = 0,res=0;
scanf("%d", &t);
for (int i = 0; i < t; i++)
{
int stu = 0, apple = 0;
scanf("%d %d", &stu, &apple);
res += apple % stu;
}
printf("%d", res);
return 0;
}