repeat digits

#include <stdio.h>
#include <stdlib.h>
typedef int BOOL;
#define true 1
#define false 0
int main()
{
    BOOL digit_seen[10] = {false};
    int  digit;
    long int n;
    printf("Enter a number:");
    scanf("%ld",&n);
    while(n > 0)
    {
        digit = n % 10;
        if(digit_seen[digit])
        {
            break;
        }
        digit_seen[digit] = true;
        n /= 10;
    }
    if(n > 0)
    {
        printf("Repeated digit. \n");
    }
    else
        printf("No repeated digit\n");
    system("pause");
    return 0;
}
时间: 2024-10-07 06:13:25

repeat digits的相关文章

Repeat Number(数论)

Repeat Number 题目描述: Definition: a+b = c, if all the digits of c are same ( c is more than ten), then we call a and b are Repeat Number. My question is How many Repeat Numbers in [x,y]. 输入 There are several test cases. Each test cases contains two int

Repeat Number

Problem B: Repeat Number Time Limit: 1 Sec  Memory Limit: 32 MB Description Definition: a+b = c, if all the digits of c are same ( c is more than ten),then we call a and b are Repeat Number. My question is How many Repeat Numbers in [x,y]. Input Ther

2014辽宁省赛 Repeat Number

问题 C: Repeat Number 时间限制: 1 Sec  内存限制: 128 MB 提交: 23  解决: 7 [cid=1073&pid=2&langmask=0">提交][状态][论坛] 题目描写叙述 Definition: a+b = c, if all the digits of c are same ( c is more than ten).then we call a and b are Repeat Number. My question is Ho

POJ 3373 Changing Digits

题目大意: 给出一个数n,求m,使得m的长度和n相等,能被k整除.有多个数符合条件输出与n在每位数字上改变次数最小的.改变次数相同的输出大小最小的.  共有两种解法:DP解法,记忆化搜索的算法. 以后会更新记忆化搜索. 1.DP解法: 解题思路: DP[i][j]表示数n的前i位除以k余j最小改变几位. DP[len][0]就表示数n被k整除最小改变几位. 根据这个关系从后向前遍历DP数组可以找出所有满足条件的数的路径. 再根据关系从前往后输出.  下面是代码: #include <stdio.

mysql while,loop,repeat循环,符合条件跳出循环

1.while循环 DELIMITER $$ DROP PROCEDURE IF EXISTS `sp_test_while`$$ CREATE PROCEDURE `sp_test_while`( IN p_number INT, #要循环的次数 IN p_startid INT #循环的其实值 ) BEGIN DECLARE v_val INT DEFAULT 0; SET v_val=p_startid; outer_label: BEGIN #设置一个标记 WHILE v_val<=p_

NVIDIA DIGITS 学习笔记(NVIDIA DIGITS-2.0 + Ubuntu 14.04 + CUDA 7.0 + cuDNN 7.0 + Caffe 0.13.0)

转自:http://blog.csdn.net/enjoyyl/article/details/47397505?from=timeline&isappinstalled=0#10006-weixin-1-52626-6b3bffd01fdde4900130bc5a2751b6d1 NVIDIA DIGITS-2.0 + Ubuntu 14.04 + CUDA 7.0 + cuDNN 7.0 + Caffe 0.13.0环境配置 引言 DIGITS简介 DIGITS特性 资源信息 说明 DIGI

Talbot basically sweating the idea and can be happy for the repeat functionality

Practically no one enjoyed more NHL hockey when compared with Cam Talbot last time. It has not been even shut. The Edmonton Oilers goaltender made 73 appearances, which has been seven over his closest thing competitor, Toronto's Frederik Andersen. Th

JDBC程序执行步骤--repeat

package com.lucia.repeat; import java.sql.Connection;import java.sql.DriverManager;import java.sql.PreparedStatement;import java.sql.ResultSet;import java.sql.SQLException; /** * 主要是练习jdbc程序的运行步骤 * @author lenovo * */public class JDBCRepeat {    publ

Codeforces Round #277.5 (Div. 2)C. Given Length and Sum of Digits...(贪心)

传送门 Description You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the d