답안 #1104130

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1104130 2024-10-23T01:54:08 Z ezzzay Fancy Fence (CEOI20_fancyfence) C++14
컴파일 오류
0 ms 0 KB
#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define pb push_back
#define int long long
const int N=3e5+5;
int h[N];
int w[N];
int mod=1e9+7;
int modd(int n){
    return (n%mod+mod)%mod;
}
int cal(int a, int b){
    int f=(a*(a+1))%mod*((mod+1)/2)%mod;
    int s=(b*(b+1))%Mod*((mod+1)/2)%mod;
    return (f*s)%mod;
}
signed main(){
    int n;
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>h[i];
    }
    for(int i=1;i<=n;i++){
        cin>>w[i];
    }
    int ans=0;
    for(int i=n;i>=1;i--){
        ans+=calc(h[i],w[i])-calc(h[i-1],w[i]);
        ans=modd(ans);
    }
    cout<<ans;
}

Compilation message

fancyfence.cpp: In function 'long long int cal(long long int, long long int)':
fancyfence.cpp:16:21: error: 'Mod' was not declared in this scope; did you mean 'mod'?
   16 |     int s=(b*(b+1))%Mod*((mod+1)/2)%mod;
      |                     ^~~
      |                     mod
fancyfence.cpp: In function 'int main()':
fancyfence.cpp:30:14: error: 'calc' was not declared in this scope; did you mean 'cal'?
   30 |         ans+=calc(h[i],w[i])-calc(h[i-1],w[i]);
      |              ^~~~
      |              cal