csharp基础练习题:猫年,狗年【难度:0级】--景越C#经典编程题库,不同难度C#练习题,适合自学C#的新手进阶训练

csharp基础练习题:猫年,狗年【难度:0级】:

习题任务

我有一只猫和一只狗.

我让他们在同一时间,小猫/小狗.这是humanYears年前.

现在回到各自的年龄为[humanYears,catYears,dogYears]

笔记:

  • humanYears> = 1
  • humanYears仅整数

年猫

*15猫年,第一年
*+ 9猫年,第二年
*+ 4猫年后每年对于

狗年月

*15狗年历第一年
*+ 9狗年第二年
*+ 5狗年后每年对于

** ** 引用

  • http://www.catster.com/cats-101/calculate-cat-age-in-cat-years
  • http://www.slate.com/articles/news_and_politics/explainer/2009/05/a_dogs_life.html

如果你喜欢这个习题还有另外一个相关的一个这里

编程目标:

public class Dinglemouse {
  public static int[] humanYearsCatYearsDogYears(int humanYears) {
    // Your code here!
    return new int[]{0,0,0};
  }
}


测试样例:

namespace Solution {
  using NUnit.Framework;
  using System;
  // TODO: Replace examples and use TDD development by writing your own tests
  [TestFixture]
  public class SolutionTest
  {
    public void One()
    {
      Assert.AreEqual(new int[]{1,15,15}, Dinglemouse.humanYearsCatYearsDogYears(1));
    }
    [Test]
    public void Two()
    {


最佳答案(多种解法):

点击查看答案

更多关联题目:

免责申明

本博客所有编程题目及答案均收集自互联网,主要用于供网友学习参考,如有侵犯你的权益请联系管理员及时删除,谢谢
题目收集至https://www.codewars.com/
https://www.codewars.com/kata/cat-years-dog-years

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值