0
已解决
王文博
缔造者之神
缔造者之神
大神指教!
(如果认为酷町豆不够多,可以加,前提是有我满意的答案)
错误代码:
#include <bits/stdc++.h>
#pragma GCC optimize(3)
#pragma GCC target("avx")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-ftree-pre")
#pragma GCC optimize("-ftree-vrp")
#pragma GCC optimize("-fpeephole2")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-fsched-spec")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-falign-jumps")
#pragma GCC optimize("-falign-loops")
#pragma GCC optimize("-falign-labels")
#pragma GCC optimize("-fdevirtualize")
#pragma GCC optimize("-fcaller-saves")
#pragma GCC optimize("-fcrossjumping")
#pragma GCC optimize("-fthread-jumps")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-fwhole-program")
#pragma GCC optimize("-freorder-blocks")
#pragma GCC optimize("-fschedule-insns")
#pragma GCC optimize("inline-functions")
#pragma GCC optimize("-ftree-tail-merge")
#pragma GCC optimize("-fschedule-insns2")
#pragma GCC optimize("-fstrict-aliasing")
using namespace std;
int n,maxn1=-0x3f3f3f3f,pos=0;
int a[10001];
int c;
int b[10001][10001],cnt[10001];
int main()
{
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>a[i];
while(a[i]!=0)
{
c++;
b[i][c]=a[i]%2;
a[i]/=2;
}
for(int j=c;j>=1;j--) if(b[i][j]==1) cnt[i]++;
cout<<cnt[i]<<" ";
if(cnt[i]<maxn1)
{
maxn1=cnt[i];
pos=i;
}
c=0;
}
cout<<a[pos];
}