阅读程序 普及篇(9-14题)

9、NOIP2002

#include <iostream>
#include <cstdio>
using namespace std;
int a[21],i,j,p,n,q,s;
int main( )
{
	scanf("%d%d%d",&p,&n,&q);
	j=21;
	while(n>0)
	{
		j=j-1;
		a[j]=n%10;
		n=n/10;
	}
	s=0;
	for(i=j;j<=20;++i) s=s*p+a[i];
	printf("%d\n",s);
	j=21;
	while(s>0)
	{
		j=j-1;
		a[j]=s%q;
		s=s/q;
	}
	for(i=j;i<=20;++i) printf("%d",a[i]);
	printf("\n");
	return 0;
}
/*
输入:7 3051 8
输出
答案:
1065
2051 
*/

阅读程序 普及篇 10、NOIP2004

https://blog.csdn.net/dllglvzhenfeng/article/details/130904258


11、NOIP2004提高组 阅读程序写结果 4.2

 

//NOIP2004提高组 阅读程序写结果 4.2
#include <stdio.h>

int number,ndata,sum;
int data[100];//data[101] pascal
void solve(int s,int sign,int n){
    int i;
    for(i=s;i<ndata;i++){//i<=ndata pascal
        sum+=sign*(number/n/data[i]);//number/(n*data[i]) pascal
        solve(i+1,-sign,n*data[i]);
    }
}

int main(){
    int i;
    
    scanf("%d %d",&number,&ndata);
    sum=0;
    for(i=0;i<ndata;i++)//for(i=1;i<=ndata;i++) pascal
        scanf("%d",&data[i]);
    solve(0,1,1);//solve(1,1,1); pascal
    printf("%d\n",sum);
    return 0;
}
//输入:1000 3 5 13 11
//输出:
//答案:328 

阅读程序 普及篇 12、NOIP2005 提高组

https://blog.csdn.net/dllglvzhenfeng/article/details/130979091


13、NOIP2007初赛普及组_阅读程序写结果3.2

#include <iostream> 
#include <bits/stdc++.h>
using namespace std;
void fun(int *a,int *b) {	 
	int *k; //定义的指针变量k
	k=a; a=b; b=k;
} 
int main( ) {
	int a=3, b=6, *x=&a, *y=&b; 
	fun(x,y);
	cout<<a<<","<<b<<endl; 
} 
/*
输出:____________________
答案:3,6
*/

14、NOIP2007提高组初赛4.3

/*
NOIP2007提高组初赛4.3 
*/
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int a1[51]={0};
	int i,j,t,t2,n=50;
	for (i=2;i<=sqrt(n);i++)
		if(a1[i]==0)
		{
			t2=n/i;
			for(j=2;j<=t2;j++) a1[i*j]=1;
		}
	t=0;
	for (i=2;i<=n;i++)
		if(a1[i]==0)
		{	
			cout<<setw(4)<<i; t++;
			if(t%10==0) cout<<endl;
		}
	cout<<endl;
	return 0;
}
/*
输出:__________
答案:
2 3 5 7 11 13 17 19 23 29
31 37 41 43 47 
*/

小学生C++趣味编程 测试题(33套)

小学生C++趣味编程 测试题(33套)_dllglvzhenfeng的博客-CSDN博客

 

 

GoC编程工具、GoC软件、GoC编程PPT

GoC编程工具、GoC软件、GoC编程PPT_dllglvzhenfeng的博客-CSDN博客

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

dllglvzhenfeng

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值