设为首页 加入收藏

TOP

UVA 10127 - Ones(数论)
2015-07-24 05:58:10 来源: 作者: 【 】 浏览:7
Tags:UVA 10127 Ones 数论

UVA 10127 - Ones

题目链接

题意:求出多少个1组成的数字能整除n
思路:一位位去取模,记录答案即可
代码:

#include 
   
     #include 
    
      int n; int main() { while (~scanf("%d", &n)) { int ans = 1; int now = 1; while (now) { now = (now * 10 + 1) % n; ans++; } printf("%d\n", ans); } return 0; }
    
   
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇Codeforces 437C The Child and T.. 下一篇杭电 2602 Bone Collector

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: