给定一个正整数n,请返回0到n(包括n)的数字中2出现了几次。 测试样例: 10 返回:1
加载中...
import java.util.*; public class Count2 { public int countNumberOf2s(int n) { // write code here } }
class Count2 { public: int countNumberOf2s(int n) { // write code here } };
# -*- coding:utf-8 -*- class Count2: def countNumberOf2s(self, n): # write code here
class Count2 { public int countNumberOf2s(int n) { // write code here } }