P5712 【深基3.例4】Apples(python3 C++ Scratch实现)

2022/2/8 20:14:14

本文主要是介绍P5712 【深基3.例4】Apples(python3 C++ Scratch实现),对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

【深基3.例4】Apples - 洛谷

python3代码:

"""
P5712 【深基3.例4】Apples(python3实现)
https://www.luogu.com.cn/problem/P5712

"""
x=int( input() )

if x==0 or x==1:
            
            print("Today, I ate %d apple."%x)
            
else:
            print("Today, I ate %d apples."%x)




C++代码:

/* 
P5712 【深基3.例4】Apples
https://www.luogu.com.cn/problem/P5712
*/
#include <bits/stdc++.h>
using namespace std;
int main( void )
{
	int x;
	
	cin>>x;
	
	if (x==0 || x==1)
	{
		printf("Today, I ate %d apple.",x);
	}
	else
	{
		printf("Today, I ate %d apples.",x);
	}
	
	return 0;
}
/*
作业:
P5703	【深基2.例5】苹果采购		
P5704	【深基2.例6】字母转换		
P5705	【深基2.例7】数字反转 
*/


Scratch2代码:

 

 



scratch3代码:

 

 

 



这篇关于P5712 【深基3.例4】Apples(python3 C++ Scratch实现)的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程