[알고리즘 문제 풀기] 謎紛芥索紀 (Small)(14730)

C#
lhs's avatar
Mar 25, 2025
[알고리즘 문제 풀기] 謎紛芥索紀 (Small)(14730)
notion image

1. 문제 풀이 아이디어

  • 미분의 원리를 생각하여 차수와 계수를 곱해 문제를 해결할 수 있다.

2. 나의 정답 코드

using (StreamReader sr = new StreamReader(Console.OpenStandardInput())) using (StreamWriter sw = new StreamWriter(Console.OpenStandardOutput())) { int n = int.Parse(sr.ReadLine()); int result = 0; for(int i = 0; i < n; i++) { int[] a = Array.ConvertAll(sr.ReadLine().Split(), int.Parse); result += a[0] * a[1]; } sw.WriteLine(result); }

3. 정리

  • 입력을 받은 차수와 계수를 곱해 결과 값에 더한다.
  • n번 반복한 후 결과를 출력해 문제를 해결한다.
Share article

LHS's Study Space