Submission #968969
Source Code Expand
#include<bits/stdc++.h> #define int long long #define rep(i,n)for(long long i=0;i<n;i++) using namespace std; int a[200000]; int b[200000]; int gcd(int a, int b) { if (!b)return a; return gcd(b, a%b); } int main() { int n, k; scanf("%d%d", &n, &k); int d = 1; rep(i, n) { scanf("%d", &a[i]); d = max(d, gcd(a[i], k)); } int j = 0; rep(i, n) { if ((a[i] * 10000 * d) % k == 0)b[j++] = a[i]; } int cnt = 0; rep(i, j) { for (long long t = i + 1; t < j; t++) { if ((i*j) % k == 0)cnt++; } } cout << cnt << endl; }
Submission Info
Submission Time | |
---|---|
Task | C - ロト2 |
User | autumn_eel |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 567 Byte |
Status | CE |
Compile Error
./Main.cpp:13:10: error: ‘::main’ must return ‘int’ int main() { ^ ./Main.cpp: In function ‘int main()’: ./Main.cpp:14:32: warning: format ‘%d’ expects argument of type ‘int*’, but argument 2 has type ‘long long int*’ [-Wformat=] int n, k; scanf("%d%d", &n, &k); ^ ./Main.cpp:14:32: warning: format ‘%d’ expects argument of type ‘int*’, but argument 3 has type ‘long long int*’ [-Wformat=] ./Main.cpp:17:20: warning: format ‘%d’ expects argument of type ‘int*’, but argument 2 has type ‘long long int*’ [-Wformat=] scanf("%d", &a[i]); ^ ./Main.cpp:14:33: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] int n, k; scanf("%d%d", &n, &k); ^ ./Main.cpp:17:21: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d", &a[i]); ^