30 条题解
-
-3
#include <bits/stdc++.h> using namespace std; int main(){ int n,arr[105],k=0; cin>>n; for(int i=1;i<=n;i++){ cin>>arr[i]; } for(int i=1;i<=n;i++){ int a,b,c,d,m; a=arr[i]/1000; b=arr[i]/100%10; c=arr[i]/10%10; d=arr[i]%10; m=d-b-c-a; if(m>0) k++; } cout<<k; return 0; }
-
-3
#include #include using namespace std; struct jyd{ double weight,value,v; }arr[4]; bool cmp(jyd a,jyd b){ return a.v>b.v; } int main(){ for(int i=0;i<4;i++){ cin>>arr[i].weight>>arr[i].value; arr[i].v=arr[i].value/arr[i].weight; } sort(arr,arr+4,cmp); double n=300,s=0; for(int i=0;i<4;i++){ if(n>=arr[i].weight) s = s+arr[i].value; else s = s+arr[i].vn; n = n-arr[i].weight; if(n<=0) break; } cout<<s; return 0 ; } / 180 208 208 520 50 210 */
-
-4
#include<bits/stdc++.h> using namespace std; int a[10][110]; int res[11000]; int main(){ int n;cin>>n; int mx=0; for(int i=1;i<=n;i++){ cin>>res[i]; int x=res[i]; int c=0; while(x){ x/=10; c++; } mx=max(mx,c); int cc=1; for(int i=1;i<mx;i++){ for(int j=1;j<=n;j++){ int x=res[j]; x/=cc; a[x%10][0]++; a[x%10][a[x%10][0]]=res[j]; } int idx=1; for(int j=0;j<10;j++){ for(int k=1;k<=a[j][0];k++){ res[idx]=a[j][k]; idx++; } a[j][0]=0 } cc*=10
} } for(int i=1;i<=n;i++) cout<<res[i]<<" "; return 0;
}
-
-4
#include<bits/stdc++.h> using namespace std; int cnt[26]; int main(){ string s; getline(cin,s); for(int i=0;i<s.size();i++){ if(s[i]>='a'&&s[i]<='z'){ s[i]-=32; } if(s[i]>='A'&&s[i]<='Z'){ cnt[s[i]-'A']++; } } for(int i=0;i<26;i++){ cout<<char(i+'A')<<":"; for(int j=1;j<=cnt[i];j++){ cout<<"*"; } cout<<endl; } }
-
-4
#include #include using namespace std; struct jyd{ double weight,value,v; }arr[4]; bool cmp(jyd a,jyd b){ return a.v>b.v; } int main(){ for(int i=0;i<4;i++){ cin>>arr[i].weight>>arr[i].value; arr[i].v=arr[i].value/arr[i].weight; } sort(arr,arr+4,cmp); double n=300,s=0; for(int i=0;i<4;i++){ if(n>=arr[i].weight) s = s+arr[i].value; else s = s+arr[i].vn; n = n-arr[i].weight; if(n<=0) break; } cout<<s; return 0 ; } / 180 208 208 520 50 210 */
信息
- ID
- 1
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 4
- 标签
- 递交数
- 44
- 已通过
- 21
- 上传者