4 solutions
-
0
#include<stdio.h> int main() { long long n,c,ans = 1;; int count; while(~scanf("%lld%lld",&n,&c)) { long long a[117]; for(int i = 0;i < n;i ++) { scanf("%lld",&a[i]); } ans = ((a[0]%c) * (a[1]%c))%c; for(int i = 2;i < n; i++) { a[i] %= c; ans *= a[i]; ans %= c; a[i] = 0; } printf("%lld\n",ans); } return 0; }
-
0
#include<bits/stdc++.h> using namespace std; #define ll long long ll a[205]; int main(){ ll n,c,ans; while(scanf("%lld%lld",&n,&c)!=EOF){ for(int i=0;i<n;i++){ cin>>a[i]; } for(int i=0;i<n;i++){ a[i]=a[i]%c; } ans=((a[0]%c)*(a[1]%c))%c; for(int i=2;i<n;i++){ ans=((ans%c)*(a[i]%c))%c; } cout<<ans<<endl; } return 0; }
- 1
Information
- ID
- 283
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 7
- Tags
- # Submissions
- 199
- Accepted
- 45
- Uploaded By