文章

2

粉丝

142

获赞

3

访问

1.1k

头像
数字统计 题解:
P1002 兰州大学机试题
发布于2023年7月25日 11:42
阅读数 653

#include<bits/stdc++.h>
using namespace std;
int main(){
  int L,R,count=0,temp;
  cin>>L>>R;
  for(int i=L;i<=R;i++){
      temp=i;
      while(temp!=0){
          // 一般数字 
          if(temp%10==2)count++;
          //处理整数的情况 
          if(temp%10==0){
              int temp1=temp;
              while(temp1/10!=0){
                  if(temp1==2)
                  count++;
                temp1/=10;    
        &nbs...

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发