CCF-1题代码整合

 1 //CCF201709-1打酱油(简单计算:函数关系) 
 2 #include<iostream>
 3 using namespace std;
 4 int main(){
 5     int n,temp,sum=0;
 6     cin>>n;
 7     temp=n/50;
 8     sum+=7*temp;
 9     n-=temp*50;
10     temp=n/30;
11     sum+=4*temp;
12     n-=temp*30;
13     sum+=n/10;
14     cout<<sum<<endl;
15     return 0;
16 } 
 1 //CCF201703-1分蛋糕(简单计算:数据分组) 
 2 #include<iostream>
 3 using namespace std;
 4 int main(){
 5     int n,k,temp,i,sum=0,ans=0;
 6     cin>>n>>k;
 7     for(i=0;i<n;i++){
 8         cin>>temp;
 9         sum+=temp;
10         if(sum>=k){
11             sum=0;
12             ans++;
13         }
14     }
15     if(sum!=0)
16         ans++;
17     cout<<ans<<endl;
18     return 0;
19 } 
 1 //CCF201612-1中间数(排序)
 2 //中间数如果存在,则一定为有序数组最中间的数 
 3 //反证:中间数串不经过 中间位置,则必有一半以上大于(小于)该中间数,与题意不符 
 4 #include<iostream>
 5 #include<algorithm> 
 6 int a[1001];
 7 using namespace std;
 8 int main(){
 9     int n,i,ans,right,left;
10     cin>>n;
11     for(i=0;i<n;i++){
12         cin>>a[i];
13     }
14     sort(a,a+n);//用sort(数组名,数组首地址+数组长)来排序 
15     ans=a[n/2];
16     right=n/2;
17     left=n-n/2-1;
18     for(i=n/2-1;i>=0;i--){
19         if(a[i]==ans){
20             right--;
21         }else{
22             break;
23         }
24     }
25     for(i=n/2+1;i<n;i++){
26         if(a[i]==ans){
27             left--;
28         }else{
29             break;
30         }
31     }
32     if(left==right){
33         cout<<ans<<endl;
34     }else{
35         cout<<-1<<endl;
36     }
37     return 0;
38 } 
 1 //CCF201609-1最大波动(简单判断) 
 2 #include<iostream>
 3 using namespace std;
 4 int f(int x){//绝对值
 5     return x>0?x:-x;
 6 } 
 7 int main(){
 8     int n,i,last,now,temp,ans=0;
 9     cin>>n;
10     cin>>last;
11     for(i=1;i<n;i++){
12         cin>>now;
13         temp=f(now-last);
14         if(temp>ans){
15             ans=temp;
16         }
17         last=now;
18     }
19     cout<<ans<<endl;
20     return 0;
21 } 
//CCF201604-1折点计数(简单判断) 
#include<iostream>
using namespace std;
int main(){
    int i,n,day1,day2,now,ans=0;
    cin>>n;
    if(n==2){
        cin>>day1;
        ans=0;
    }else{
        cin>>day1>>day2;
        for(i=2;i<n;i++){
            cin>>now;
            if((day1>day2&&day2<now)||(day1<day2&&day2>now)){
                ans++;
            }
            day1=day2;
            day2=now;
        }
    }
    cout<<ans<<endl;
    return 0;
} 
 1 //CCF201512-1数位之和(字符串转数字:数字太大有必要的话)
 2 // int 可以表示10^9,所以本题可直接用int存储,不用转化 
 3 #include<iostream>
 4 using namespace std;
 5 int main(){
 6     int n,ans=0;
 7     cin>>n;
 8     while(n!=0){
 9         ans+=n%10;
10         n/=10;
11     }
12     cout<<ans<<endl;
13     return 0;
14 } 
 1 //CCF201509-1数位之和(简单判断)
 2 #include<iostream>
 3 using namespace std;
 4 int main(){
 5     int n,i,temp1,temp2,ans=1;
 6     cin>>n;
 7     cin>>temp1;
 8     for(i=1;i<n;i++){
 9         cin>>temp2;
10         if(temp2!=temp1){
11             ans++;
12             temp1=temp2;
13         }
14     }
15     cout<<ans<<endl;
16     return 0;
17 } 
 1 //CCF201503-1图像旋转(矩阵坐标变换)
 2 #include<iostream>
 3 using namespace std;
 4 int a[1001][1001];
 5 int main(){
 6     int row,col,i,j;
 7     cin>>row>>col;
 8     for(i=0;i<row;i++){
 9         for(j=0;j<col;j++){
10             cin>>a[i][j];
11         }
12     }
13     for(i=col-1;i>=0;i--){
14         for(j=0;j<row;j++){
15             cout<<a[j][i]<<' ';
16         }
17         cout<<"\b\n";
18     }
19     return 0;
20 }
 1 //CCF201412-1门禁系统(利用map,数组也可) 
 2 //map<int,int>::iterator it,其中it->first键it->second值 
 3 #include<iostream>
 4 #include<map>
 5 using namespace std;
 6 int main(){
 7     map<int,int> m;
 8     int i,n,temp; 
 9     cin>>n;
10     for(i=0;i<n;i++){
11         cin>>temp;
12         m[temp]++;
13         cout<<m[temp]<<' '; 
14     }
15     cout<<"\b\n";
16     return 0;
17 }
 1 //CCF201409-1相邻数对(标志数组,memset(数组,初值,sizeof(数组名))用来初始化)
 2 //memset要include<string.h>这一点很重要!!  3 #include<iostream>  4 #include<string.h>  5 using namespace std;  6 int a[1002];  7 int main(){  8 int n,i,temp,ans=0;  9 memset(a,0,sizeof(a)); 10 cin>>n; 11 for(i=0;i<n;i++){ 12 cin>>temp; 13 a[temp]=1; 14 if(a[temp+1]){//有先后次序,所以不需要去重 15 ans++; 16  } 17 if(temp!=0&&a[temp-1]==1){ 18 ans++; 19  } 20  } 21 cout<<ans<<endl; 22 return 0; 23 }
 1 //CCF201409-1相邻数对(标志数组结合绝对值/负值映射到正值) 
 2 //因为所有的数不相等,所以当同个绝对值下标落了两个数时,这两个必为相反数  3 #include<iostream>  4 #include<string.h>  5 using namespace std;  6 int a[1002];  7 int f(int x){  8 return x>0?x:-x;  9 } 10 int main(){ 11 int n,i,temp,ans=0; 12 memset(a,0,sizeof(a)); 13 cin>>n; 14 for(i=0;i<n;i++){ 15 cin>>temp; 16 if(a[f(temp)]){ 17 ans++; 18  } 19 a[f(temp)]=1; 20  } 21 cout<<ans<<endl; 22 return 0; 23 }
 1 //CCF201409-1相邻数对(利用map查找) 
 2 #include<iostream>
 3 #include<map>
 4 using namespace std;  5 int main(){  6 int i,n,temp,ans=0;  7 map<int,int> m;  8 cin>>n;  9 for(i=0;i<n;i++){ 10 cin>>temp; 11 if(m.find(-temp)==m.end()){ 12 m[temp]++;//找不到相反数,加入自身 13 }else{ 14 ans++;//找到相反数,结果加1 15  } 16  } 17 cout<<ans<<endl; 18 return 0; 19 }
 1 //CCF201312-1出现次数最多的数(利用标志数组) 
 2 #include<iostream>
 3 #include<string.h>  4 using namespace std;  5 int a[10001];  6 int main(){  7 int i,n,temp,ans=0,max=0;  8 memset(a,0,sizeof(a));  9 cin>>n; 10 for(i=0;i<n;i++){ 11 cin>>temp; 12 a[temp]++; 13 if(a[temp]>max){ 14 ans=temp; 15 max=a[temp]; 16  } 17  } 18 cout<<ans<<endl; 19 return 0; 20 }
 1 //CCF201312-1出现次数最多的数(利用map) 
 2 //map<int,int>::iterator it,其中it->first键it->second值  3 #include<iostream>  4 #include<map>  5 using namespace std;  6 int main(){  7 map<int,int> m;  8 int i,n,temp,ans=0,count=0;  9 cin>>n; 10 for(i=0;i<n;i++){ 11 cin>>temp; 12 m[temp]++; 13  } 14 for(map<int,int>::iterator it=m.begin();it!=m.end();it++){ 15 if(it->second>count){ 16 count=it->second; 17 ans=it->first; 18  } 19  } 20 cout<<ans<<endl; 21 return 0; 22 }

 

转载于:https://www.cnblogs.com/gf-fish/articles/7932274.html

以下是对提供的参考资料的总结,按照要求结构化多个要点分条输出: 4G/5G无线网络优化与网规案例分析: NSA站点下终端掉4G问:部分用户反馈NSA终端频繁掉4G,主要因终端主动发起SCGfail导致。分析显示,在信号较好的环境下,终端可能因节能、过热保护等原因主动释放连接。解决方案建议终端侧进行分析处理,尝试关闭节电开关等。 RSSI算法识别天馈遮挡:通过计算RSSI平均值及差值识别天馈遮挡,差值大于3dB则认定有遮挡。不同设备分组规则不同,如64T和32T。此方法可有效帮助现场人员识别因环境变化引起的网络问。 5G 160M组网小区CA不生效:某5G站点开启100M+60M CA功能后,测试发现UE无法正常使用CA功能。问原因在于CA频点集标识配置错误,修正后测试正常。 5G网络优化与策略: CCE映射方式优化:针对诺基亚站点覆盖农村区域,通过优化CCE资源映射方式(交织、非交织),提升RRC连接建立成功率和无线接通率。非交织方式相比交织方式有显著提升。 5G AAU两扇区组网:与三扇区组网相比,AAU两扇区组网在RSRP、SINR、下载速率和上传速率上表现不同,需根据具体场景选择适合的组网方式。 5G语音解决方案:包括沿用4G语音解决方案、EPS Fallback方案和VoNR方案。不同方案适用于不同的5G组网策略,如NSA和SA,并影响语音连续性和网络覆盖。 4G网络优化与资源利用: 4G室分设备利旧:面对4G网络投资压减与资源需求矛盾,提出利旧多维度调优策略,包括资源整合、统筹调配既有资源,以满足新增需求和提质增效。 宏站RRU设备1托N射灯:针对5G深度覆盖需求,研究使用宏站AAU结合1托N射灯方案,快速便捷地开通5G站点,提升深度覆盖能力。 基站与流程管理: 爱立信LTE基站邻区添加流程:未提供具体内容,但通常涉及邻区规划、参数配置、测试验证等步骤,以确保基站间顺畅切换和覆盖连续性。 网络规划与策略: 新高铁跨海大桥覆盖方案试点:虽未提供详细内容,但可推测涉及高铁跨海大桥区域的4G/5G网络覆盖规划,需考虑信号穿透、移动性管理、网络容量等因素。 总结: 提供的参考资料涵盖了4G/5G无线网络优化、网规案例分析、网络优化策略、资源利用、基站管理等多个方面。 通过具体案例分析,展示了无线网络优化中的常见问及解决方案,如NSA终端掉4G、RSSI识别天馈遮挡、CA不生效等。 强调了5G网络优化与策略的重要性,包括CCE映射方式优化、5G语音解决方案、AAU扇区组网选择等。 提出了4G网络优化与资源利用的策略,如室分设备利旧、宏站RRU设备1托N射灯等。 基站与流程管理方面,提到了爱立信LTE基站邻区添加流程,但未给出具体细节。 新高铁跨海大桥覆盖方案试点展示了特殊场景下的网络规划需求。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值