답안 #19247

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
19247 2016-02-22T15:08:45 Z gs14004 Uniting (kriii2_U) C++14
4 / 4
10 ms 1116 KB
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <string>
#include <functional>
#include <vector>
#include <numeric>
#include <deque>
#include <utility>
#include <bitset>
#include <assert.h>
#include <iostream>
using namespace std;
typedef long long lint;
typedef long double llf;
typedef pair<int, int> pi;
const int mod = 1e9 + 7;
int n, a[100005];

int main(){
	scanf("%d",&n);
	lint s = 0, sc = 0, fc = 1;
	for(int i=0; i<n; i++){
		scanf("%d",&a[i]);
		s += a[i];
		sc += a[i] * a[i];
	}
	for(int i=2; i<=n; i++){
		fc *= (1ll * i * (i-1)) % mod;
        fc %= mod;
	}
	s = (s * s - sc) / 2;
	printf("%lld\n%lld",s,fc);
}

Compilation message

U.cpp: In function 'int main()':
U.cpp:28:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   28 |  scanf("%d",&n);
      |  ~~~~~^~~~~~~~~
U.cpp:31:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   31 |   scanf("%d",&a[i]);
      |   ~~~~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 472 KB Output is correct
2 Correct 0 ms 356 KB Output is correct
3 Correct 0 ms 352 KB Output is correct
4 Correct 0 ms 356 KB Output is correct
5 Correct 0 ms 612 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 356 KB Output is correct
8 Correct 0 ms 468 KB Output is correct
9 Correct 0 ms 352 KB Output is correct
10 Correct 1 ms 356 KB Output is correct
11 Correct 1 ms 360 KB Output is correct
12 Correct 1 ms 356 KB Output is correct
13 Correct 1 ms 360 KB Output is correct
14 Correct 1 ms 356 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 ms 356 KB Output is correct
17 Correct 1 ms 456 KB Output is correct
18 Correct 1 ms 352 KB Output is correct
19 Correct 1 ms 356 KB Output is correct
20 Correct 1 ms 352 KB Output is correct
21 Correct 2 ms 360 KB Output is correct
22 Correct 1 ms 456 KB Output is correct
23 Correct 2 ms 356 KB Output is correct
24 Correct 2 ms 348 KB Output is correct
25 Correct 2 ms 616 KB Output is correct
26 Correct 2 ms 612 KB Output is correct
27 Correct 2 ms 608 KB Output is correct
28 Correct 2 ms 604 KB Output is correct
29 Correct 3 ms 616 KB Output is correct
30 Correct 2 ms 616 KB Output is correct
31 Correct 3 ms 612 KB Output is correct
32 Correct 3 ms 612 KB Output is correct
33 Correct 3 ms 704 KB Output is correct
34 Correct 3 ms 612 KB Output is correct
35 Correct 3 ms 680 KB Output is correct
36 Correct 3 ms 616 KB Output is correct
37 Correct 3 ms 612 KB Output is correct
38 Correct 4 ms 736 KB Output is correct
39 Correct 4 ms 604 KB Output is correct
40 Correct 4 ms 860 KB Output is correct
41 Correct 7 ms 844 KB Output is correct
42 Correct 6 ms 860 KB Output is correct
43 Correct 7 ms 860 KB Output is correct
44 Correct 5 ms 860 KB Output is correct
45 Correct 5 ms 860 KB Output is correct
46 Correct 5 ms 844 KB Output is correct
47 Correct 4 ms 860 KB Output is correct
48 Correct 5 ms 860 KB Output is correct
49 Correct 10 ms 1084 KB Output is correct
50 Correct 7 ms 1116 KB Output is correct