QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#572635#9355. Keeping RabbitsN_z_AC ✓136ms4080kbC++144.8kb2024-09-18 15:45:182024-09-18 15:45:18

Judging History

你现在查看的是最新测评结果

  • [2024-09-18 15:45:18]
  • 评测
  • 测评结果:AC
  • 用时:136ms
  • 内存:4080kb
  • [2024-09-18 15:45:18]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
struct time_helper
{
#ifdef LOCAL
	clock_t time_last;
#endif
	time_helper()
	{
#ifdef LOCAL
		time_last=clock();
#endif
	}
	void test()
	{
#ifdef LOCAL
		auto time_now=clock();
		std::cerr<<"time:"<<1.*(time_now-time_last)/CLOCKS_PER_SEC<<";all_time:"<<1.*time_now/CLOCKS_PER_SEC<<std::endl;
		time_last=time_now;
#endif
	}
	~time_helper()
	{
		test();
	}
}time_helper;
#ifdef LOCAL
#include"dbg.h"
#else
#define dbg(...) (__VA_ARGS__)
#endif
namespace Fread{const int SIZE=1<<16;char buf[SIZE],*S,*T;inline char getchar(){if(S==T){T=(S=buf)+fread(buf,1,SIZE,stdin);if(S==T)return'\n';}return *S++;}}namespace Fwrite{const int SIZE=1<<16;char buf[SIZE],*S=buf,*T=buf+SIZE;inline void flush(){fwrite(buf,1,S-buf,stdout);S=buf;}inline void putchar(char c){*S++=c;if(S==T)flush();}struct NTR{~NTR(){flush();}}ztr;}
#define getchar Fread::getchar
#define putchar Fwrite::putchar
#define Setprecision 10
#define between '\n'
template<typename T>struct is_char{static constexpr bool value=(std::is_same<T,char>::value||std::is_same<T,signed char>::value||std::is_same<T,unsigned char>::value);};template<typename T>struct is_integral_ex{static constexpr bool value=(std::is_integral<T>::value||std::is_same<T,__int128>::value)&&!is_char<T>::value;};template<typename T>struct is_floating_point_ex{static constexpr bool value=std::is_floating_point<T>::value||std::is_same<T,__float128>::value;};namespace Fastio{struct Reader{template<typename T>typename std::enable_if_t<std::is_class<T>::value,Reader&>operator>>(T&x){for(auto &y:x)*this>>y;return *this;}template<typename T>typename std::enable_if_t<is_integral_ex<T>::value,Reader&>operator>>(T&x){char c=getchar();short f=1;while(c<'0'||c>'9'){if(c=='-')f*=-1;c=getchar();}x=0;while(c>='0'&&c<='9'){x=(x<<1)+(x<<3)+(c^48);c=getchar();}x*=f;return *this;}template<typename T>typename std::enable_if_t<is_floating_point_ex<T>::value,Reader&>operator>>(T&x){char c=getchar();short f=1,s=0;x=0;T t=0;while((c<'0'||c>'9')&&c!='.'){if(c=='-')f*=-1;c=getchar();}while(c>='0'&&c<='9'&&c!='.')x=x*10+(c^48),c=getchar();if(c=='.')c=getchar();else return x*=f,*this;while(c>='0'&&c<='9')t=t*10+(c^48),s++,c=getchar();while(s--)t/=10.0;x=(x+t)*f;return*this;}template<typename T>typename std::enable_if_t<is_char<T>::value,Reader&>operator>>(T&c){c=getchar();while(c=='\n'||c==' '||c=='\r')c=getchar();return *this;}Reader&operator>>(char*str){int len=0;char c=getchar();while(c=='\n'||c==' '||c=='\r')c=getchar();while(c!='\n'&&c!=' '&&c!='\r')str[len++]=c,c=getchar();str[len]='\0';return*this;}Reader&operator>>(std::string&str){str.clear();char c=getchar();while(c=='\n'||c==' '||c=='\r')c=getchar();while(c!='\n'&&c!=' '&&c!='\r')str.push_back(c),c=getchar();return*this;}Reader(){}}cin;const char endl='\n';struct Writer{typedef __int128 mxdouble;template<typename T>typename std::enable_if_t<std::is_class<T>::value,Writer&>operator<<(T x){for(auto &y:x)*this<<y<<between;*this<<'\n';return *this;}template<typename T>typename std::enable_if_t<is_integral_ex<T>::value,Writer&>operator<<(T x){if(x==0)return putchar('0'),*this;if(x<0)putchar('-'),x=-x;static int sta[45];int top=0;while(x)sta[++top]=x%10,x/=10;while(top)putchar(sta[top]+'0'),--top;return*this;}template<typename T>typename std::enable_if_t<is_floating_point_ex<T>::value,Writer&>operator<<(T x){if(x<0)putchar('-'),x=-x;x+=pow(10,-Setprecision)/2;mxdouble _=x;x-=(T)_;static int sta[45];int top=0;while(_)sta[++top]=_%10,_/=10;if(!top)putchar('0');while(top)putchar(sta[top]+'0'),--top;putchar('.');for(int i=0;i<Setprecision;i++)x*=10;_=x;while(_)sta[++top]=_%10,_/=10;for(int i=0;i<Setprecision-top;i++)putchar('0');while(top)putchar(sta[top]+'0'),--top;return*this;}template<typename T>typename std::enable_if_t<is_char<T>::value,Writer&>operator<<(T c){putchar(c);return*this;}Writer&operator<<(char*str){int cur=0;while(str[cur])putchar(str[cur++]);return *this;}Writer&operator<<(const char*str){int cur=0;while(str[cur])putchar(str[cur++]);return*this;}Writer&operator<<(std::string str){int st=0,ed=str.size();while(st<ed)putchar(str[st++]);return*this;}Writer(){}}cout;}
#define cin Fastio::cin
#define cout Fastio::cout
#define endl Fastio::endl
template<class Fun>class y_combinator_result{Fun fun_;public:template<class T>explicit y_combinator_result(T &&fun): fun_(std::forward<T>(fun)) {}template<class ...Args>decltype(auto) operator()(Args &&...args){return fun_(std::ref(*this), std::forward<Args>(args)...);}};template<class Fun>decltype(auto) y_combinator(Fun &&fun){return y_combinator_result<std::decay_t<Fun>>(std::forward<Fun>(fun));}

void solve();
main()
{
	int t=1;
	cin>>t;
	while(t--)solve();
}
void solve()
{
	int n,k;
	cin>>n>>k;
	vector<int>a(n);
	long long s=0;
	for(auto &q:a)cin>>q,s+=q;
	for(auto &q:a)cout<<q+1.*q/s*k<<' ';cout<<endl;
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3556kb

input:

3
1 1
2
2 2
1 3
3 2
1 1 1

output:

3.0000000000 
1.5000000000 4.5000000000 
1.6666666667 1.6666666667 1.6666666667 

result:

ok 6 numbers

Test #2:

score: 0
Accepted
time: 0ms
memory: 3784kb

input:

10
10 5
6 9 4 4 4 7 6 2 8 7
10 3
9 4 10 4 2 8 8 6 4 7
10 2
2 5 9 4 9 4 2 7 5 9
10 5
9 1 2 1 10 10 7 9 7 1
10 6
8 3 1 10 5 3 1 6 3 10
10 10
5 9 1 7 10 7 6 6 4 4
10 6
1 7 9 5 1 1 6 3 6 5
10 7
5 6 9 1 9 7 1 1 4 5
10 3
4 10 3 3 10 9 3 6 9 10
10 6
5 5 1 2 4 6 8 1 8 2

output:

6.5263157895 9.7894736842 4.3508771930 4.3508771930 4.3508771930 7.6140350877 6.5263157895 2.1754385965 8.7017543860 7.6140350877 
9.4354838710 4.1935483871 10.4838709677 4.1935483871 2.0967741935 8.3870967742 8.3870967742 6.2903225806 4.1935483871 7.3387096774 
2.0714285714 5.1785714286 9.321428571...

result:

ok 100 numbers

Test #3:

score: 0
Accepted
time: 0ms
memory: 3624kb

input:

10
10 2
18 23 74 43 31 61 59 9 82 39
10 6
82 44 26 99 29 100 24 45 14 8
10 3
10 76 15 14 73 94 48 83 84 20
10 1
35 20 48 6 17 75 57 78 76 39
10 9
13 92 32 23 32 93 13 38 34 64
10 9
45 41 26 90 96 9 20 37 93 14
10 9
81 3 56 89 58 30 21 2 93 28
10 4
69 4 11 77 81 24 19 70 4 85
10 8
5 39 89 36 82 37 12...

output:

18.0820045558 23.1047835991 74.3371298405 43.1958997722 31.1412300683 61.2779043280 59.2687927107 9.0410022779 82.3735763098 39.1776765376 
83.0445859873 44.5605095541 26.3312101911 100.2611464968 29.3694267516 101.2738853503 24.3057324841 45.5732484076 14.1783439490 8.1019108280 
10.0580270793 76.4...

result:

ok 100 numbers

Test #4:

score: 0
Accepted
time: 1ms
memory: 3628kb

input:

10
100 28
54 29 35 99 52 7 52 91 49 4 71 33 22 90 11 73 28 13 43 64 26 47 53 56 32 76 40 80 90 84 18 90 24 96 81 66 82 21 75 58 46 52 45 38 36 82 66 33 4 54 2 57 43 9 64 43 72 10 1 31 80 89 49 100 35 61 44 45 51 51 39 80 80 11 31 95 65 59 81 43 81 2 46 60 90 65 83 55 52 93 80 66 61 29 23 99 2 64 22 ...

output:

54.2882195959 29.1547845978 35.1868089973 99.5284025925 52.2775447960 7.0373617995 52.2775447960 91.4857033931 49.2615325963 4.0213495997 71.3789553946 33.1761341975 22.1174227983 90.4803659931 11.0587113992 73.3896301944 28.1494471979 13.0693861990 43.2295081967 64.3415935951 26.1387723980 47.25085...

result:

ok 1000 numbers

Test #5:

score: 0
Accepted
time: 136ms
memory: 4080kb

input:

1005
89 48
24 95 46 14 50 35 66 24 31 84 66 39 16 80 14 78 49 46 8 19 2 33 97 37 40 85 13 19 51 58 24 87 87 69 77 62 65 5 10 5 15 75 12 32 35 24 13 90 64 89 71 22 94 31 70 93 38 89 56 26 78 56 74 32 28 52 35 61 87 17 1 54 2 88 62 34 74 27 47 18 12 57 88 39 37 76 36 24 31
89 70
71 4 27 56 36 65 33 6 ...

output:

24.2758620690 96.0919540230 46.5287356322 14.1609195402 50.5747126437 35.4022988506 66.7586206897 24.2758620690 31.3563218391 84.9655172414 66.7586206897 39.4482758621 16.1839080460 80.9195402299 14.1609195402 78.8965517241 49.5632183908 46.5287356322 8.0919540230 19.2183908046 2.0229885057 33.37931...

result:

ok 589000 numbers

Extra Test:

score: 0
Extra Test Passed