제출 #945103

#제출 시각아이디문제언어결과실행 시간메모리
945103ReverberateFancy Fence (CEOI20_fancyfence)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define INF 1e18
#define DEBUG 0
#define MOD 1e9 + 6

signed main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n, W = 0, H = 0; cin >> n;
	
	for(int i = 0; i < n; i++){
		int h; cin >> h;
		H = h;
	}
	for(int i = 0; i < n; i++){
		int w; cin >> w;
		W += w;
	}
	int temp = (((H%MOD)*((H%MOD)+1))%MOD)/2;
	int temp2 = (((W%MOD)*((W%MOD)+1))%MOD)/2;
	int temp3 = (temp*temp2)%MOD;
	cout << temp3;
}

컴파일 시 표준 에러 (stderr) 메시지

fancyfence.cpp: In function 'int main()':
fancyfence.cpp:22:17: error: invalid operands of types 'long long int' and 'double' to binary 'operator%'
   22 |  int temp = (((H%MOD)*((H%MOD)+1))%MOD)/2;
      |                ~^
      |                |
      |                long long int
fancyfence.cpp:22:26: error: invalid operands of types 'long long int' and 'double' to binary 'operator%'
   22 |  int temp = (((H%MOD)*((H%MOD)+1))%MOD)/2;
      |                         ~^
      |                         |
      |                         long long int
fancyfence.cpp:23:18: error: invalid operands of types 'long long int' and 'double' to binary 'operator%'
   23 |  int temp2 = (((W%MOD)*((W%MOD)+1))%MOD)/2;
      |                 ~^
      |                 |
      |                 long long int
fancyfence.cpp:23:27: error: invalid operands of types 'long long int' and 'double' to binary 'operator%'
   23 |  int temp2 = (((W%MOD)*((W%MOD)+1))%MOD)/2;
      |                          ~^
      |                          |
      |                          long long int
fancyfence.cpp:24:26: error: invalid operands of types 'long long int' and 'double' to binary 'operator%'
   24 |  int temp3 = (temp*temp2)%MOD;
      |              ~~~~~~~~~~~~^
      |                   |
      |                   long long int