UVa 10696 f91 (water ver.)

阿里云国内75折 回扣 微信号:monov8
阿里云国际,腾讯云国际,低至75折。AWS 93折 免费开户实名账号 代冲值 优惠多多 微信号:monov8 飞机:@monov6


10696 - f91

Time limit: 3.000 seconds

http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=1637

Background

McCarthy is a famous theorician of computer science. In his work, he defined a recursive function, called f91, that takes as input a positive integer N and returns a positive integer defined as follows:

  • If N ≤ 100, then f91(N) = f91(f91(N+11));
  • If N ≥ 101, then f91(N) = N-10.

The Problem

Write a program, that computes McCarthy's f91.

The Input

The input tests will consist of a series of positive integers, each integer is at most 1,000,000. There will be at most 250,000 test cases. Each number is on a line on its own. The end of the input is reached when the number 0 is met. The number 0 shall not be considered as part of the test set.

Output

The program shall output each result on a line by its own, following the format given in the sample output.

Sample input


500 91 0


Sample output


f91(500) = 490 f91(91) = 91



完整代码:

/*0.078s*/

#include<cstdio>

int main(void)
{
	int N;
	while (scanf("%d", &N), N)
		if (N <= 100) printf("f91(%d) = 91\n", N);
		else printf("f91(%d) = %d\n", N, N - 10);
	return 0;
}



阿里云国内75折 回扣 微信号:monov8
阿里云国际,腾讯云国际,低至75折。AWS 93折 免费开户实名账号 代冲值 优惠多多 微信号:monov8 飞机:@monov6

“UVa 10696 f91 (water ver.)” 的相关文章

vue.prototype和vue.use的区别和注意点有哪些 - 开发技术

本篇内容介绍了“vue.prototype和vue.use的区别和注意点有哪些”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!vue.prototype和vue.use的...

动态链接库与静态链接库

动态链接库(DLL)是windows操作系统的基础,通常都不能直接运行,也不能接收消息.它们是一些独立的文件,其中包含能被可执行程序或其它DLL调用来完成某项工作的函数,只有在其它函数调用动态链接库时,它才发挥作用. Windows API中所有函数都包含在...

流黄稠鼻涕是什么感冒

风热感冒是风热之邪犯表、肺气失和所致。症状表现为发热重、微恶风、头胀痛、有汗、咽喉红肿疼痛、咳嗽、痰粘或黄、鼻塞黄涕、口渴喜饮、舌尖边红、苔薄白微黄。治法应以辛凉解表为主。常选用菊花、薄荷、桑叶等。《银翘散》、《桑菊饮》。服成药可选用银翘解毒丸(片)、羚翘解毒丸、桑菊感冒片、板兰根冲剂等。如发热...

Qt 之 MediaPlayer 音视频播放

文章目录 1、QMediaPlayer简介2、相关类介绍2.1 QMediaPlayer2.1.1 简单用法2.1.2 关键枚举类2.1.3 QMediaPlayer 常用属性 2.2 QVideoWidget2.3 QMediaPlaylist2.4 QML 相关用法2.4.1 Me...

Vue.js中的会话数据怎么使用 - web开发

这篇文章主要介绍了Vue.js中的会话数据怎么使用的相关知识,内容详细易懂,操作简单快捷,具有一定借鉴价值,相信大家阅读完这篇Vue.js中的会话数据怎么使用文章都会有所收获,下面我们一起来看看吧。 Vue.js中的会话概述会话是Web应用...

Codeforces Beta Round #47 / 50A Domino piling(贪心)_贪心java

A. Domino piling http://codeforces.com/problemset/problem/50/A time limit per test memory limit per test input...