UOJ Logo

NOI.AC

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#193797#3398. countmikefeng10011ms2136kbC++111.6kb2023-10-14 14:35:082023-10-14 18:37:14

answer

bool M1;
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdlib>
#include<climits>
#include<iomanip>
#include<cassert>
#include<random>
#include<cstdio>
#include<vector>
#include<bitset>
#include<stack>
#include<queue>
#include<deque>
#include<cmath>
#include<ctime>
#include<map>
#include<set>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/hash_policy.hpp>
//#include<ext/pb_ds/priority_queue.hpp>
#define fi first
#define se second
#define LD double
#define name(x) #x
#define ll long long
#define Vector Point
#define I128 __int128
#define ull unsigned ll
#define pii pair<ll,ll>
#define pb(x) push_back(x)
#define dek(x) debug(x)<<" "
#define deh(x) debug(x)<<endl
#define syt cerr<<"sytakioi\n"
#define debug(x) cout<<name(x)<<":"<<x
#define F(i,a,b) for(int i=a,i##end=b;i<=i##end;++i)
#define UF(i,a,b) for(int i=a,i##end=b;i>=i##end;--i)
#define look_memory cerr<<abs(&M2-&M1)/1024.0/1024<<'\n'
#define rd_i(l,r) uniform_int_distribution<int>(l,r)(rd)
#define rd_r(l,r) uniform_real_distribution<double>(l,r)(rd)
#define look_time cerr<<(clock()-Time)*1.0/CLOCKS_PER_SEC<<'\n'
using namespace std;
//using namespace __gnu_cxx;
mt19937 rd(time(0));
const int N=1e5+5;
const int p=1e9+7;
int n;
int a[N],b[N];
ll pw[N],ans,res;
bool M2;
int main(){
	int Time=clock();
	look_memory;
	cin.tie(nullptr)->sync_with_stdio(false);
	cin>>n;
	pw[0]=1;F(i,1,9) pw[i]=pw[i-1]*10;
	F(i,1,n){
		cin>>a[i];
		F(j,0,9) if(a[i]>=pw[j]) b[i]=j+1;
		res=(res+pw[b[i]])%p;
		ans=(ans+1ll*(n-1)*a[i])%p;
	}
	F(i,1,n) ans=(ans+a[i]*(res-pw[b[i]]+p))%p;
	cout<<ans<<'\n';
	look_time;
	return 0;
}

Details

小提示:点击横条可展开更详细的信息

Test #1:

score: 20
Accepted
time: 1ms
memory: 1376kb

input:

1000
332109541 265698305 339007233 386487277 65597920 217218907 436378017 221884663 270433433 268014...

output:

675688319

result:

ok single line: '675688319'

Test #2:

score: 20
Accepted
time: 0ms
memory: 1376kb

input:

1000
108652253 396843081 18739163 168730297 41598432 22132831 155692945 617160601 164753707 86147692...

output:

653845876

result:

ok single line: '653845876'

Test #3:

score: 20
Accepted
time: 0ms
memory: 1376kb

input:

1000
71158753 11073019 119630785 162780801 25368543 517705 123835636 254874371 4127795 157084999 201...

output:

126629477

result:

ok single line: '126629477'

Test #4:

score: 20
Accepted
time: 0ms
memory: 1376kb

input:

1000
496106605 30223789 139619196 52432001 12405522 405765988 35664524 102798391 192246625 760951562...

output:

891456070

result:

ok single line: '891456070'

Test #5:

score: 20
Accepted
time: 10ms
memory: 2136kb

input:

100000
227552529 170886571 513851125 46675201 188079376 255537313 266819605 69661658 214521435 33384...

output:

677195751

result:

ok single line: '677195751'