-
백준 14579번: 덧셈과 곱셈사칙연산(Arithmetic Operation) 2018. 10. 21. 15:48반응형
https://www.acmicpc.net/problem/14579
1. 문제
2. 알고리즘
키워드 - 수학
3. 코드
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253#include <iostream>#include <sstream>#include <string>#include <algorithm>#include <functional>#include <vector>#include <list>#include <queue>#include <deque>#include <map>#include <set>#include <stack>#include <math.h>#include <memory.h>using namespace std;#define MAX_SIZE 100#define INF 0x7fffffff#define CENDL "\n"#define ll long long#define c_reverse(s) reverse(s.begin(), s.end())#define c_sort(s) sort(s.begin(), s.end())#define print_vector(v) for(int i=0; i<v.size(); i++) cout << v[i];int count(int c){int d = 0;for (int i = 1; i <= c; i++) {d = d + i;}return d;};int main() {cin.tie(0);std::ios::sync_with_stdio(false);int a,b; cin >> a >> b;int sol = 1;for (int i = a; i <= b; i++ ) {sol = sol * count(i);sol = sol % 14579;}if(a < b && a >= 1 && b<= 1000) {cout << sol << CENDL;}return 0;}cs 반응형'사칙연산(Arithmetic Operation)' 카테고리의 다른 글
백준 15726번: 이칙연산 (0) 2018.07.29 백준 14652번: 나는 행복합니다~ (0) 2018.07.28 백준 14489번: 치킨 두 마리 (0) 2018.07.28 백준 13900번: 순서쌍의 곱의 합 (0) 2018.07.28 백준 14470번: 전자레인지 (0) 2018.07.28