Intuition๋จ์ ์ํ ๊ตฌํ์ผ๋ก ํ๋ฉด ๋๋ค๊ณ ์๊ฐํ๋ค.Approach(๊ฐ ์ํ์ฅ์ ๊ฐ์์ ์ - ์ด๊ฐ๋ ๊ด(B))/C + (๊ฐ ์ํ์ฅ์ ๊ฐ์์ ์ - ์ด๊ฐ๋ ๊ด(B))%C ? 1 : 0;์ผ๋ก ๊ตฌํํ๋ค. ํ์ง๋ง ๊ฐ ์ํ์ฅ์ ๊ฐ์์ ์ - ์ด๊ฐ๋ ๊ด(B)์ด ์์๊ฐ ๋๋ ๊ฒฝ์ฐ๋ฅผ ๊ณ ๋ คํ์ง ๋ชปํด ๋ช๋ฒ ํ๋ ธ๋ค.์์์ธ ๊ฒฝ์ฐ ๊ฐ ์ํ์ฅ์ ๊ฐ์์ ์ - ์ด๊ฐ๋ ๊ด(B)์ 0์ผ๋ก ๋ฐ๊ฟ์ฃผ๋ฉด ๋๋ค.Complexity- Time complexity : O(N)- Space complexity : O(N)Code#include using namespace std;long long ans;int main() { long long N, arr[1000001]; cin>>N; for (int i=0; i>arr[i]; ..