Submission #9780

#TimeUsernameProblemLanguageResultExecution timeMemory
9780dominyellowUniting (kriii2_U)C++98
0 / 4
0 ms1236 KiB
#include <stdio.h> #include <map> #include <queue> #include <set> #include <vector> using namespace std; long modu = 1000000007; long get_multi(vector<long> vec){ long res = vec[0]%modu; for(int i=1; i<vec.size(); i++){ res = (res*(vec[i]%modu))%modu; } return res; } long get_permu(long a){ if(a == 2){ return 2; } return (a%modu * (a-1)%modu)%modu + get_permu(a-1); } int main(void){ long dept_count; scanf("%ld", &dept_count); vector<long> unite_cost; long tmp; for(int i=0; i<dept_count; i++){ scanf("%ld", &tmp); unite_cost.push_back(tmp); } printf("%ld\n", get_multi(unite_cost)); printf("%ld\n", get_permu(dept_count)); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...