打卡信奥刷题(257)用Scratch图形化工具信奥P9859 [普及组][CCC 2008 S2] Pennies in the Ring

[CCC 2008 S2] Pennies in the Ring

题面翻译

你在玩一个游戏,它给了你一个圆的半径$(1 \leq $ 半径 ≤ 25000 ) \leq 25000) 25000)。假设圆的圆心是在一个半径 × \times × 半径的图中的正中间,请你求出,有多少个点是包含在圆内的(当一个点在圆的边上时也算)。

本题有多组数据,当读入到 0 0 0 时视为程序结束。

题目描述

The game “Pennies in the Ring” is often played by bored computer programmers who have gotten tired of playing solitare. The objective is to see how many pennies can be put into a circle. The circle is drawn on a grid, with its center at the coordinate ( 0 , 0 ) (0, 0) (0,0). A single penny is placed on every integer grid coordinate (e.g., ( 1 , 1 ) (1, 1) (1,1), ( 1 , 2 ) (1, 2) (1,2), etc.) that lies within or on the circle. It’s not a very exciting game, but it’s very good for wasting time. Your goal is to calculate how many pennies are needed for a circle with a given radius.

输入格式

The input is a sequence of positive integer values, one per line, where each integer is the radius of a circle. You can assume the radius will be less than or equal to 25000 25000 25000. The last integer will be indicated by 0 0 0. You may assume that the grid is large enough for two pennies to be on adjacent integer coordinates and not touch.

输出格式

You are to output, each on its own line, the number of pennies needed for each circle. You do not need to output 0 0 0 for the last 0 0 0. You may assume that the number of possible pennies is less than 2 2 2 billion (which is only 20 20 20 million dollars: computer scientists have lots of money).

样例 #1

样例输入 #1

2
3
4
0

样例输出 #1

13
29
49

Scratch实现

在这里插入图片描述

后续

接下来我会不断用scratch来实现信奥比赛中的算法题、Scratch考级编程题实现、白名单赛事考题实现,感兴趣的请关注,我后续将继续分享相关内容

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值