https://www.acmicpc.net/problem/2475
아이디어:
함수 작성
// 2475
#include <iostream>
using namespace std;
int calc(int a, int b, int c, int d, int e) {
return ((a * a) + (b * b) + (c * c) + (d * d) + (e * e)) % 10;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
int a, b, c, d, e, f;
cin >> a >> b >> c >> d >> e;
f = calc(a, b, c, d, e);
cout << f;
return 0;
}
'algorithm' 카테고리의 다른 글
백준 10250번 ACM 호텔 (0) | 2024.11.03 |
---|---|
백준 31403번 A+B-C (0) | 2024.10.27 |
백준 15964번 이상한 기호 (0) | 2024.10.27 |
백준 2754번 학점계산 (0) | 2024.10.27 |
백준 2744번 대소문자 바꾸기 (2) | 2024.10.27 |