UCF Local Programming Contest 2012(Practice)补题

Posted wsytj

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了UCF Local Programming Contest 2012(Practice)补题相关的知识,希望对你有一定的参考价值。

Clean Up the Powers that Be

主要是输出格式上的问题

 1 #include <iostream>
 2 #include <cstring>
 3 using namespace std;
 4 int main(){
 5     long long t,s[10005];
 6     cin>>t;
 7     int p=0;
 8     while(t--){
 9         p++;
10         memset(s,0,sizeof(s));
11         int n;
12         cin>>n;
13         for(int i=0;i<n;i++){
14             int a,b;
15             cin>>a>>b;
16             s[a]+=b;
17         }
18         cout<<"Prime Factorization #"<<p<<":"<<endl;
19         for(int i=1;i<10005;i++){
20             //cout<<s[i]<<" ";
21             if(s[i]!=0){
22                 //cout<<s[i]<<" ";
23                 int k=i;
24                 while(k!=0){
25                     k/=10;
26                     cout<<" ";
27                 }
28                 cout<<s[i];
29             }
30         }
31         cout<<endl;
32         for(int i=1;i<10005;i++){
33             if(s[i]!=0){
34                 cout<<i;
35                 int k=s[i];
36                 while(k!=0){
37                     k/=10;
38                     cout<<" ";
39                 }
40             }
41         }
42         cout<<endl<<endl;
43     }
44 }

 

以上是关于UCF Local Programming Contest 2012(Practice)补题的主要内容,如果未能解决你的问题,请参考以下文章

UCF Local Programming Contest 2017(2020-04-06)

UCF Local Programming Contest 2012(Practice)补题

UCF Local Programming Contest 2016正式赛

UCF Local Programming Contest 2016 3.29

UCF Local Programming Contest 2015(Practice)个人分析

UCF Local Programming Contest 2012(Practice)