hrbust1001 Probability One

本文解析了一道经典的猜数字游戏模拟题,介绍了游戏规则及编程实现方法。通过简单的数学运算,可以预测并验证朋友心中所想的数字。

原题网址:http://acm.hrbust.edu.cn/index.php?m=ProblemSet&a=showProblem&problem_id=1001

Probability One
Time Limit: 1000 MSMemory Limit: 65536 K
Total Submit: 3209(1356 users)Total Accepted: 1412(1213 users)Rating: Special Judge: No
Description
Number guessing is a popular game between elementary-school kids. Teachers encourage pupils to play the game as it enhances their arithmetic skills, logical thinking, and following-up simple procedures. We think that, most probably, you too will master in few minutes. Here’s one example of how you too can play this game: Ask a friend to think of a number, let’s call it n 0.
Then:
1. Ask your friend to compute n 1 = 3 * n 0 and to tell you if n1 is even or odd.
2. If n 1 is even, ask your friend to compute n 2 = n 1/2. If, otherwise, n 1 was odd then let your friend compute n 2 = (n 1 + 1)/2.
3. Now ask your friend to calculate n 3 = 3 * n 2.
4. Ask your friend to tell tell you the result of n 4 = n 3/9. (n 4 is the quotient of the division operation. In computer lingo, ’/’ is the integer-division operator.)
5. Now you can simply reveal the original number by calculating n 0 = 2 * n 4 if n 1 was even, or n 0 = 2 * n 4 + 1 otherwise.
Here’s an example that you can follow: If n 0 = 37, then n 1 = 111 which is odd. Now we can calculate n 2 = 56, n 3= 168, and n 4 = 18, which is what your friend will tell you. Doing the calculation 2 × n 4 + 1 = 37 reveals n 0.
 
Input
Your program will be tested on one or more test cases. Each test case is made of a single positive number (0 < n 0 < 1, 000, 000).
The last line of the input file has a single zero (which is not part of the test cases.)
 
Output
For each test case, print the following line:
k. B Q
Where k is the test case number (starting at one,) B is either ’even’ or ’odd’ (without the quotes) depending on your friend’s answer in step 1. Q is your friend’s answer to step 4.
Note: There is a blank space before B.
 
Sample Input
37
38
0
Sample Output
1. odd 18
2. even 19

一道模拟基础题,按照题目步奏来,注意输入和输出与第一题的变化。

#include<stdio.h>

int main()
{
    int n0;
    int Case = 1;
    while(scanf("%d",&n0) != EOF){
        if(n0 == 0){
            return 0;
        }

        int n1 = 3*n0;
        bool flag;
        if(n1%2 == 1){
            flag = true;//奇数
        }
        else{
            flag = false;//偶数
        }

        int n2;
        if(!flag){
            n2 = n1/2;
        }
        else{
            n2 = (n1+1)/2;
        }

        int n3 = 3*n2;

        int n4 = n3/9;

        if(!flag)
            printf("%d. even %d\n",Case++,n4);
        else
            printf("%d. odd %d\n",Case++,n4);
    }
    return 0;
}


内容概要:本文详细介绍了一个基于Java和Vue技术栈的足球赛事数据战术可视化分析系统的设计与实现。系统涵盖数据采集与预处理、结构化存储、智能分析建模、战术可视化、安全权限管理及微服务扩展等核心模块,实现了从原始赛事数据到多维度战术洞察的全流程自动化处理。项目融合机器学习算法(如聚类、时空轨迹识别、关键路径分析)进行阵型识别与行为挖掘,并通过ECharts、D3.js等前端技术实现高度交互的动态可视化展示。系统支持多角色权限控制、多源数据兼容、实时数据流处理与报表导出,适用于职业俱乐部、青训、体育科研、新媒体等多个场景,具备高可扩展性与云原生架构潜力。文档提供了完整的功能模块设计、数据库建模、API接口规范、前后端代码实现及部署方案,是一套理论与实践紧密结合的全栈开发实例。; 适合人群:具备Java和Vue开发基础的中高级程序员、体育数据分析从业者、高校计算机或体育信息专业师生,以及从事智能体育系统研发的技术团队。; 使用场景及目标:①构建专业级足球战术分析平台,辅助教练团队进行科学决策与训练优化;②学习前后端分离架构下复杂业务系统的搭建方法;③掌握大数据可视化、机器学习在体育领域的落地应用;④作为毕业设计、科研项目或企业级产品原型参考。; 阅读建议:建议结合文档中的代码示例与系统架构图逐步实践,优先搭建基础环境并运行核心模块,再深入理解智能分析算法与权限控制机制。在学习过程中应重点关注数据流设计、前后端交互逻辑与可视化实现细节,并尝试扩展支持其他体育项目或多模态交互功能。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值