toj 4607 Multiple of 17

时间限制(普通/Java):1000MS/3000MS 内存限制:65536KByte
总提交: 33 测试通过:17

描述

Theorem: If you drop the last digit d of an integer n (n10), subtract 5d from the remaining integer, then the difference is a multiple of 17 if and only if n is a multiple of 17.

For example, 34 is a multiple of 17, because 3-20=-17 is a multiple of 17; 201 is not a multiple of 17, because 20-5=15 is not a multiple of 17.

Given a positive integer n, your task is to determine whether it is a multiple of 17.

输入

There will be at most 10 test cases, each containing a single line with an integer n ( 1n10100). The input terminates with n = 0, which should not be processed.

输出

For each case, print 1 if the corresponding integer is a multiple of 17, print 0 otherwise.

样例输入

34
201
2098765413
1717171717171717171717171717171717171717171717171718
0

样例输出

1
0
1
0

#include <iostream>
#include <cstdio>
using namespace std;int main()
{char s[10000];while(scanf("%s", s) && (s[0] != '0')){int sum = 0;for(int i = 0; s[i] != '\0'; i++){sum = (sum * 10 +s[i] - '0');sum %= 17;}if(sum == 0)printf("1\n");elseprintf("0\n");}return 0;
}

toj 4607 Multiple of 17相关推荐

  1. C++ Primer(第4版)(评注版)

    <C++ Primer(第4版)(评注版)> 基本信息 原书名: C++ Primer (4th Edition) 原出版社: Addison-Wesley Professional; 4 ...

  2. go select 与 for 区别_Go 面试每天一篇(第 102 天)

    点击上方蓝色"Golang来啦"关注我哟 加个"星标",天天 15 分钟,一起学 Go 你好哇,欢迎来答题,一起来看下昨天题目的解析: 1.关于循环语句,下面说 ...

  3. 推荐!计算机视觉最适合入门的 8 本教程,算法与实战兼备

    点击上方"AI有道",选择"星标"公众号 重磅干货,第一时间送达 计算机视觉是人工智能的一个分支,涉及理解数字图像的内容,如照片和视频.深度学习在挑战性的计算机 ...

  4. 7.25第一次组队赛

    Problem A UVA 11877 The Coco-Cola Store 直接输出n/2 1 #include <stdio.h> 2 int main() 3 { 4 int n; ...

  5. 论文学习——StyleGan原文精读

    原论文地址:https://arxiv.org/pdf/1812.04948.pdf 原论文及翻译,参考研究,能力有限,不一定每句话都准确,欢迎讨论 A Style-Based Generator A ...

  6. 计算机与通信英语,数据与计算机通信(第十版)(英文版)

    数据与计算机通信(第十版)(英文版) 语音 编辑 锁定 讨论 上传视频 <数据与计算机通信(第十版)(英文版)>是2018年6月电子工业出版社出版的图书,作者是William Stalli ...

  7. 《How Tomcat Works》读书笔记(三)--Connector(连接器)

    <How Tomcat Works>读书笔记(三)--Connector(连接器) 这是<How Tomcat Works>第三四章的读书笔记.主要写了Tomcat4.0默认的 ...

  8. C++ Primer - 5th Edition - 书中源代码 - 课后习题答案

    C++ Primer - 5th Edition - 书中源代码 - 课后习题答案 C++ Primer - 5th Edition - 书中源代码 - 课后习题答案 1. C++ Primer, 5 ...

  9. (Stacked Hourglass Networks for Human Pose Estimation)用于人体姿势估计的堆叠沙漏网络

    摘要 This work introduces( 提出) a novel(新奇的) convolutional network architecture for the task of human p ...

最新文章

  1. Redis低成本高可用方案设计
  2. Vue中bus的使用
  3. Linux系统安装VM-Tools
  4. 本地构建和自动化构建_构建自动化面板
  5. 通用 CRUD 接口
  6. 程序员竟然钟爱这个!我 low了
  7. 用C++ 设计一个不能被继承的类
  8. 华为数据之道(5):华为数字化转型的目标、蓝图和愿景
  9. 相位和群时延的ADS仿真
  10. 用java怎么开发图片标注工具,一些好用的图片标注工具
  11. 计算机内存128毫升,内存128.1M的微信怎么可能只能聊天!
  12. Oracle数据库连接池原理,数据库连接池的原理及实现
  13. python在视频上方加字_使用moviepy给视频加字遇到的坑
  14. 分治策略找第K小元素
  15. 有关clipToPadding、 clipChildren的那些事
  16. 『这辈子就相爱《何苦要等下辈子》 李草青青、肖玄MV』
  17. 联盛德W806入门教程-CDK安装教程及代码下烧录
  18. 【优化】近端梯度下降(Proximal Gradient Descent)求解Lasso线性回归问题
  19. HTML应用开发基础篇 - MUI 框架(三)MUI 布局
  20. ThingJS官方案例(四):快速应用3D场景下的模拟导航能力

热门文章

  1. C语言,利用一维数组中选择法对成绩高低排序和输出对应的学号及利用顺序查找查找学生成绩
  2. 函授计算机大专自我鉴定100字,函授大学毕业自我鉴定100字(精选5篇)
  3. 如何保护移动应用程序安全–移动应用程序安全检查表
  4. 如何使用ES6在JavaScript中有条件地构建对象
  5. c语言讲输入退回缓冲区_开始之前的结束-如何不退回输入错误的用户电子邮件...
  6. 教你使用Python实现新个税计算器
  7. 使用Python进行汽车黑客攻击:泄露GPS和OBDIICAN总线数据
  8. 使用 Python 实现鼠标键盘自动化
  9. Python编程各种推导式详解
  10. 漫步最优化三十三——牛顿法