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