纪中2020.3.14普及C组模拟赛总结

@$#!%^&*……

T1

暴力递归和差AC

A C   C o d e AC~Code AC Code

#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
using namespace std;
long long n,n2,k,x1,x2,ans=1;
void js(long long x)
{
	if((x-k)%2==0&&(x-k)>0)
	 {
	 	ans++;
	 	js((x-k)/2);      //和差问题
	 	js((x+k)/2);
	 }
}
int main()
{
    freopen("search.in","r",stdin);
    freopen("search.out","w",stdout);
    cin>>n>>k;
    js(n);
    cout<<ans;
    return 0;
}

T2

本来 100 p t s 100pts 100pts
输出没换行
0 p t s 0pts 0pts!!!!!!!!!!!!!!!!!!!!!!!!!!
悲催

A C   C o d e AC~Code AC Code

#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
using namespace std;
char a[1010][1010],b[1010][1010];
int len[1010],len2[1010];
int n,m,bj,ans[1010];
string s;
int main()
{
    freopen("word.in","r",stdin);
    freopen("word.out","w",stdout);
    cin>>n>>m;
    for(int i=1; i<=n; i++)
     {
     	cin>>s;
     	len[i]=s.size();
    	for(int j=0; j<len[i]; j++)
		   a[i][j+1]=s[j];     //一位一位存
     }
    for(int i=1; i<=m; i++)
     {
     	cin>>s;
     	len2[i]=s.size();
    	for(int j=0; j<len2[i]; j++)
		   b[i][j+1]=s[j];
     }
    for(int i=1; i<=n; i++)
     for(int j=1; j<=m; j++)
      {
      	bj=1;
      	for(int k=1; k<=len[i]; k++)
      	 {
      	 	if(a[i][k]==b[j][bj]||int(a[i][k])+32==b[j][bj]||a[i][k]==int(b[j][bj])+32)    //比较字符
      	      bj++;
      	    if(bj>len2[j])
      	     {
      	     	ans[i]++;    //记录答案
      	     	break;
      	     } 
      	 }
      }
    for(int i=1; i<=n; i++)
       cout<<ans[i]<<endl;     //输出换行!!!!!
    return 0;
}

T3

水了个暴力20分
正解:暴力模拟

A C   C o d e AC~Code AC Code

#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
using namespace std;
int n,m,d,l,k,ans,i=1,j=1;
int a[100010],b[100010];
int main()
{
    freopen("cowcar.in","r",stdin);
    freopen("cowcar.out","w",stdout);
    cin>>n>>m>>d>>l;
    for(int i=1; i<=n; i++)
       cin>>a[i];
    sort(a+1,a+1+n);
    while(1)
     {
        k=a[i]-b[j]*d;
        if(k>=l)
         {
            ans++,b[j]++;
            j++,i++;      //指针指向
            if(j>m)
              j=1;
            if(i>n)
              break;
         }
        else
         {
            i++;
            if(i>n)
              break;
         }
     }
    cout<<ans;
    return 0;
}

T4

F l o y d Floyd Floyd打错了!!!!!!!!!!!!!!!!!!!!!!!
丢了 80 p t s 80pts 80pts!!!!!!!!!!!!!!!!!!!!!!
悲催

A C   C o d e AC~Code AC Code

#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
using namespace std;
int b[1000010],a[1010][1010];
int n,m,ans;
int main()
{
    freopen("danger.in","r",stdin);
    freopen("danger.out","w",stdout);
    cin>>n>>m;
    for(int i=1; i<=m; i++)
       cin>>b[i];
    for(int i=1; i<=n; i++)
     for(int j=1; j<=n; j++)
        cin>>a[i][j];
    for(int k=1; k<=n; k++)         //Floyd
     for(int i=1; i<=n; i++)
      for(int j=1; j<=n; j++)
        if(a[i][k]+a[k][j]<a[i][j]&&i!=j&&j!=k&&k!=i)
          a[i][j]=a[i][k]+a[k][j];
    for(int i=1; i<=m-1; i++)
       ans+=a[b[i]][b[i+1]];     //统计最短路
    cout<<ans;
    return 0;
}

本来我的总分是这样的

100 + 100 + 20 + 100 = 320 p t s 100+100+20+100=320pts 100+100+20+100=320pts

结果。。。

100 + 0 + 20 + 20 = 140 p t s 100+0+20+20=140pts 100+0+20+20=140pts

总结

  1. 细心细心!再细心
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值