UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#211867#3809. 平方x_add_b570ms1148kbC++11634b2024-10-07 18:20:502024-10-07 18:40:12

answer

#include<bits/stdc++.h>

namespace IO
{
	template<typename Type>
	void read(Type &x){
		char ch=getchar();
		x=0;bool f=0;
		while(ch<'0'||ch>'9')
			f|=(ch=='-'),ch=getchar();
		while(ch>='0'&&ch<='9')
			x=((x<<1)+(x<<3)+(ch^48)),ch=getchar();
		x=f?-x:x;
	}
}

using namespace std;

#define LL long long

int V,C,seq[25],n,res;


int main()
{
	IO::read(V);
	for(int i=1;i<=V;i++){
		IO::read(C);
		while(C--)	
			seq[++n]=i;
	}
	for(int i=1;i<(1<<n);i++){
		LL ans=1;
		for(int t=0;i>>t;t++)
			if((i>>t)&1) ans*=seq[t+1];
		LL val=sqrt(ans);
		if(val*val==ans) res++;
	}
	printf("%d",res);
}

详细

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

Test #1:

score: 5
Accepted
time: 70ms
memory: 1148kb

input:

12
2 2 1 2 2 2 1 2 1 2 2 1

output:

32767

result:

ok single line: '32767'

Test #2:

score: 0
Runtime Error

input:

21
6071 63571 70449 84192 57749 63236 82243 16019 98823 69250 95932 44671 76920 1666 56759 63797 648...

output:


result:


Test #3:

score: 0
Runtime Error

input:

21
78070 53308 73131 49008 73223 91635 38770 85297 83190 39966 6535 12302 86455 15079 69516 35452 51...

output:


result:


Test #4:

score: 0
Runtime Error

input:

33
35253 15438 45783 71029 3464 55562 30300 98250 91277 30754 11674 56865 29791 79077 23593 76795 12...

output:


result:


Test #5:

score: 0
Runtime Error

input:

33
14031 20789 70420 49867 25529 65501 21352 91592 59302 81424 15091 80896 77254 33600 96383 93040 5...

output:


result:


Test #6:

score: 0
Runtime Error

input:

69
2277 90628 50971 84997 47731 58491 19590 74491 87059 48528 19450 65425 86171 98793 53240 80874 99...

output:


result:


Test #7:

score: 0
Runtime Error

input:

69
6929 54762 47684 30491 63013 85382 58761 85482 54656 20874 52114 13167 68239 91992 60774 5725 631...

output:


result:


Test #8:

score: 0
Runtime Error

input:

139
62883 20064 72746 22914 47638 63229 46693 77251 78236 615 24875 13385 17824 91084 216 55070 9832...

output:


result:


Test #9:

score: 0
Runtime Error

input:

139
19629 38452 31587 31200 1869 6696 18434 59574 94450 11252 30525 87152 78094 86067 98721 62927 56...

output:


result:


Test #10:

score: 0
Runtime Error

input:

312
70754 34698 434 7024 81418 37867 43301 45062 55942 77685 1947 49600 54159 99924 53272 31135 1756...

output:


result:


Test #11:

score: 0
Runtime Error

input:

312
12238 62101 38093 35253 92243 46623 83863 23871 48000 1097 1388 64677 89840 48843 14477 63405 21...

output:


result:


Test #12:

score: 0
Runtime Error

input:

312
65902 15679 97624 23389 1670 29206 1712 34607 36006 72210 34479 63586 47142 46925 66200 62562 94...

output:


result:


Test #13:

score: 0
Runtime Error

input:

1234
46686 11939 57055 17773 24469 47283 582 90402 27842 94874 61013 1020 28443 75832 33798 22291 20...

output:


result:


Test #14:

score: 0
Runtime Error

input:

1234
89657 93796 12385 56406 36479 74685 90947 11817 80881 79329 14528 23593 77641 70991 30841 27849...

output:


result:


Test #15:

score: 0
Runtime Error

input:

1234
26692 21448 75529 67905 19536 62310 42976 55776 64574 65478 36252 31679 45062 47707 31881 88564...

output:


result:


Test #16:

score: 0
Runtime Error

input:

4021
66995 6713 36815 57369 44032 62055 95975 29509 73258 33818 23360 74155 41951 4813 39228 48076 9...

output:


result:


Test #17:

score: 0
Runtime Error

input:

4021
78965 97182 64913 97851 50137 84422 11931 50279 43224 57995 41056 98897 21489 38558 18113 3233 ...

output:


result:


Test #18:

score: 0
Runtime Error

input:

4021
60148 5548 69611 73408 50792 67625 97878 48790 50897 56905 13105 19252 35169 541 2594 94014 514...

output:


result:


Test #19:

score: 0
Runtime Error

input:

5123
77728 68936 11371 45534 25976 11734 48963 5558 35198 28029 2396 95361 74072 72459 81788 38528 6...

output:


result:


Test #20:

score: 0
Runtime Error

input:

5123
34879 51531 20100 53943 82673 4948 38474 13579 19262 38324 28806 50542 93369 76646 80881 16857 ...

output:


result: