程序设计2018

4.

 

#include<iostream>
using namespace std;
#include<string.h>
int main(){
	int N,i,j,temp,t,sum,max;
	temp=0;sum=0;max=0;
	cin>>N;
	int arr[N][N];
	for(i=0;i<N;i++){
		for(j=0;j<N;j++){
			cin>>arr[i][j];
		}
	}
	for(j=0;j<N;j++){ 	
	max=arr[0][j];
		for(i=0;i<N-1;i++){
				if(arr[i][j]<arr[i+1][j]){
					max=arr[i+1][j];	
			}
		}
			sum=sum+max;

	}
	cout<<sum;	
	return 0;
}

5.在这里插入图片描述

 

#include<iostream>
using namespace std;
#include<string.h>
#include<cmath>
int main(){
	int len,i,a=0,t=0,k,temp,j=0;
	string arr;char b[100];
	cin>>arr;
	len=arr.length();
	for(i=len-1;i>=0;i--){
		a=(arr[i]-48)*pow(9,t)+a;
		//cout<<a<<endl;
		t++;
	}
//	cout<<a;//转换为十进制
k=a;temp=a;
while(temp!=0){
	k=k%19;
	if(k<10){
		b[j]=k+'0';
	}
	else{b[j]=k-10+'a';
	//cout<<b[j];
	}
	temp=temp/19;
	k=temp;
	j++;
	}
	for(t=j-1;t>=0;t--){
		cout<<b[t];
	}
	 
}

6.在这里插入图片描述

 

#include<iostream>
using namespace std;
int main(){
int y1,y2,y3,n1=2018,n2=12,n3=24;
int sum,i,a=0;
cin>>y1>>y2>>y3;
if(y1%4==0&&y1%100!=0||y1%400==0){
			a=1;
		}
if(y2>2){
	for(i=y1+1;i<=n1;i++){
		if(i%4==0&&i%100!=0||i%400==0){
			sum++;
		}
	}}
else{
		sum=sum+a;
	}
	cout<<sum;
}

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值