阅读程序写结果 入门篇

阅读程序写结果 入门篇 1、NOIP1998

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

阅读程序写结果 入门篇 2、NOIP1998 普及组3.2

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

阅读程序写结果 入门篇 3、NOIP2001普及组阅读程序写结果3.1

​​​​​​https://blog.csdn.net/dllglvzhenfeng/article/details/130859701


4、NOIP2001普及组阅读程序写结果3.2(C)

#include <cstdio>
using namespace std;
int ack(int m,int n){
	if(m==0) return n+1;
	else if(n==0) return ack(m-1,1);
	else return ack(m-1,ack(m,n-1));
}
int main(){
	printf("%d\n",ack(3,4));
	putchar('\n');
	return 0;
}
/*
1163:阿克曼(Ackmann)函数
http://ybt.ssoier.cn:8088/problem_show.php?pid=1163

输出:
答案:125 
*/ 

 5、NOIP2001普及组阅读程序写结果3.3

#include <cstdio>
using namespace std;
int i,j,h,m,n,k,b[11];
int main()
{
	scanf("%d",&n);
	for(i=1;i<=10;i++){
		m=n;j=11;
		while(m>0){
			j=j-1;b[j]=m%10;m=m/10;}
		for(h=1;h<=10;h++) n=n+b[h];
	}
	printf("%d",n);
}
/*
输入的n为正整数,且保证所有数都不会超出int范围. 
输入:1234
输出: 
答案:1348   
*/

6、NOIP2003普及组阅读程序写结果3.1

#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int a,x,y,ok1,ok2;
int main()
{
	a=100;
	x=20;//x=114
	y=20;
	ok1=5;
	ok2=0;
	if( (x>y) || ( (y!=20 ) && ( ok1==0 ) ) && ( ok2!=0 ) )
		a=1;
	else  if( ( ok1!=0 ) && ( ok2==0 ) )
		a=-1;
	else  a=0;
	cout<<a<<endl;
	return 0;
}
/*
输出:
答案:-1 
*/

7、NOIP2003普及组阅读程序写结果3.2

#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
using namespace std;
string a,t;
int i,j;
int main()
{
	a="morning";
	j=0;
	for(i=1;i<=6;i++)
		if(a[j]<a[i])
			j=i;
	j=j-1;
	for(i=0;i<=j;i++)
		printf("%c",a[i]);
	return 0;
}
/*
输出:
答案:mo  
*/

8、阅读程序 第1节 入门篇 NOIP2004

#include <stdio.h>
int main(){
	int i, j;
	char str1[] = "pig-is-stupid";
	char str2[] = "clever";
	str1[0] = 'd'; 
	str1[1] = 'o';
	for (i = 7, j = 0; j < 6; i++, j++) 
		str1[i] = str2[j];
	printf("%s\n", str1);
	return 0;
}
/* 
输出:____________________
答案:dog-is-clever 
*/  

9、NOIP2003普及组阅读程序写结果3.3

#include <cstdio>
#include <iostream>
#include <cstring>
using namespace std;
int a,b,c,d,sum;
int main(){
	cin>>a>>b>>c>>d;//283 102 23 320
	a=a%23;
	b=b%28;
	c=c%33;
	sum=a*5544+b*14421+c*1288-d;
	sum+=21252;
	sum%=21252;
	if( sum==0 ) sum=21252;
	cout<<sum<<endl;
	return 0;
}
/*
输入283 102 23 320
输出:
答案:8910 
*/

10、阅读程序 第1节 入门篇 NOIP2005

#include <stdio.h> 
int main() { 
	int a, b; 
	scanf("%d", &a); 
	b = (a * (a * a)) + 1; 
	if (b%3 == 0) b = b / 3; 
	if (b%5 == 0) b = b / 5; 
	if (b%7 == 0) b = b / 7; 
	if (b%9 == 0) b = b / 9; 
	if (b%11 == 0) b = b / 11; 
	if (b%13 == 0) b = b / 13; 
	if (b%15 == 0) b = b / 15; 
	printf("%d\n", (100 * a – b) / 2); 
	return 0; 
} 
/*
输入:10
输出:
答案:499 
*/ 

11、[NOIP]2005

#include <stdio.h> 
int main() { 
	char str[20] = "Today-is-terrible!"; 
	int i; 
	for (i = 6; i <= 10; i++) if (str[i] == "-") str[i-1] = "x"; 
	for (i = 12; i >= 0; i--) if (str[i] == "t") str[i+1] = "e"; 
	printf("%s", str); 
	return 0; 
} 
/*
输出:
答案: Todax-ix-terrible!  
*/

12、NOIP2006_阅读程序写结果3.3

#include <bits/stdc++.h>//#include "iostream.h"
using namespace std; 
#define N  7 
int fun(char s[],char a,int n) {
	int j; 
	j=n; 
	while(a<s[j] && j>0) j--; //s[j]<='M' 
	return j; 
} 
int main() {
	char s[N+1]; 
	int k; 
	for(k=1;k<=N;k++) // ABCDEFGHIJKLMNOPQRSTUVWXYZ
		s[k]='A'+2*k+1; //s[1]='D' s[2]='F' s[3]=H s[4]=J s[5]=L s[6]=N s[7]=P
	cout <<fun(s,'M',N)<<endl; 
} 
/*
输出:_______
答案:5 
*/ 

 


 


 

 

 

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

dllglvzhenfeng

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

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

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

打赏作者

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

抵扣说明:

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

余额充值