Submission #20153

# Submission time Handle Problem Language Result Execution time Memory
20153 2016-02-28T15:22:45 Z veckal Σ (kriii4_P2) C
Compilation error
0 ms 0 KB
#include <stdio.h>
#define MOD 1000000007
typedef long long ll;

ll pow(ll base, ll exp) {
    if (exp == 1) return base;
    ll ret = pow(base, exp>>1);
    ret = (ret * ret) % MOD;
    if (exp&1) ret = (ret * base) % MOD;
    return ret;
}

ll inv(ll a) {
    return pow(a, MOD-2);
}

int m, n, s;
int ans;

int main() {
    scanf("%d", &m);
    for (int i=0; i<m; ++i) {
        scanf("%d%d", &n, &s);
        ans = (ans + (inv(n) * s) % MOD) % MOD;
    }
    printf("%d\n", ans);
    return 0;
}

Compilation message

P2.c:5:4: warning: conflicting types for built-in function ‘pow’
 ll pow(ll base, ll exp) {
    ^
P2.c: In function ‘main’:
P2.c:22:5: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
     for (int i=0; i<m; ++i) {
     ^
P2.c:22:5: note: use option -std=c99, -std=gnu99, -std=c11 or -std=gnu11 to compile your code
P2.c:21:5: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &m);
     ^
P2.c:23:9: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d", &n, &s);
         ^