#include <cstdio>
using namespace std; char in[]; int main()
{
while(gets(in))
{
if(in[] == '' && in[] == ) break; int s = ;
for (int i = ; in[i] != ; i++)
{
s += (in[i] - '');
s *= ;
s %= ;
}
printf(s == ? "%s is a multiple of 11.\n" : "%s is not a multiple of 11.\n", in);
}
return ;
}

第二种思路不错,多想想!

 #include<iostream>
#include<string> using namespace std; int main(){
//freopen("in.txt","r",stdin);
//freopen("out.txt","w",stdout); char num[]; int sum; while(){
cin>>num; if(num[]=='' && strlen(num)==) break; sum=; for(int i=;i<strlen(num);i+=) sum+=num[i]-'';
for(int i=;i<strlen(num);i+=) sum-=num[i]-'';
cout << "sum: " << sum << endl;
if(sum%==) cout<<num<<" is a multiple of 11."<<endl;
else cout<<num<<" is not a multiple of 11."<<endl;
}
}

uva 10929 - You can say 11的更多相关文章

  1. uva10001 Garden of Eden

    Cellular automata are mathematical idealizations of physical systems in which both space and time ar ...

  2. uva10344 23 out of 5

    Your task is to write a program that can decide whether you can nd an arithmetic expression consisti ...

  3. uva11025 The broken pedometer

    6741870 ksq2013 UVA 11205 Accepted   60 C++11 5.3.0 1002 2016-08-04 14:25:22 题目大意如下:给定n个LED灯串,每个灯串由p ...

  4. uva10167 Birthday Cake

    Lucy and Lily are twins. Today is their birthday. Mother buys a birthday cake for them. Now we put t ...

  5. 地区sql

    /*Navicat MySQL Data Transfer Source Server : localhostSource Server Version : 50136Source Host : lo ...

  6. #11 UVA 10529 Dumb Bones

    题意: 放一堆排,每放一张,有pa的概率让左边的全倒,有pb的概率让右边全倒 问在最优策略下,最少要放几张才能摆放出n张 1<=n<=1000 题解: 这题应该还是很经典的 首先是期望部分 ...

  7. uva 1354 Mobile Computing ——yhx

    aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAABGcAAANuCAYAAAC7f2QuAAAgAElEQVR4nOy9XUhjWbo3vu72RRgkF5

  8. UVA 11404 Palindromic Subsequence[DP LCS 打印]

    UVA - 11404 Palindromic Subsequence 题意:一个字符串,删去0个或多个字符,输出字典序最小且最长的回文字符串 不要求路径区间DP都可以做 然而要字典序最小 倒过来求L ...

  9. UVA - 1025 A Spy in the Metro[DP DAG]

    UVA - 1025 A Spy in the Metro Secret agent Maria was sent to Algorithms City to carry out an especia ...

随机推荐

  1. PHP连续签到

    require "./global.php"; $act = isset($_GET['act']) ? $_GET['act'] : "error"; // ...

  2. Python自动化运维之2、运算符与数据类型

    python对象的相关术语: python程序中保存的所有数据都是围绕对象这个概念展开的: 程序中存储的所有数据都是对象 每个对象都有一个身份.一个类型和一个值 例如,school='MaGe Lin ...

  3. 采访:Go语言编程

    Go语言是由Google在2009年11月份公布的,它的目标是要应对软件开发所面临的最新挑战.Go语言特别被设计为快速(包括在编译时).支持多核的语言,并且兼顾了动态语言的简单性和静态类型语言的安全性 ...

  4. XP系统显示文件夹选项属性被删除解决注册表

    Title:XP系统显示文件夹选项属性被删除解决注册表 -- 2010-11-18 13:17 昨天中了个毒窝,还有恶意软件,十分不爽. 开始恶意软件把显示所有文件夹给删除了,去找了个注册表,重新注册 ...

  5. 在网页上看到想要的颜色,如何知道这种颜色的颜色代码和 RGB 颜色值?

    启动QQ的情况下,按截图快捷键(ctrl+alt+A),鼠标移动到要取色的地方即可看到,如下图: references: http://www.zhihu.com/question/20328538

  6. 设计模式(十):Decorator装饰者模式 -- 结构型模式

    1. 概述 若你从事过面向对象开发,实现给一个类或对象增加行为,使用继承机制,这是所有面向对象语言的一个基本特性.如果已经存在的一个类缺少某些方法,或者须要给方法添加更多的功能(魅力),你也许会仅仅继 ...

  7. 设计模式 ( 二十一 ):Vistor访问者模式 -- 行为型

    1.概述 在软件开发过程中,对于系统中的某些对象,它们存储在同一个集合collection中,且具有不同的类型,而且对于该集合中的对象,可以接受一类称为访问者的对象来访问,而且不同的访问者其访问方式有 ...

  8. sicily 无路可逃?(图的DFS)

    题意:在矩阵数组中搜索两点是否可达 解法:DFS #include<iostream> #include<memory.h> using namespace std; stru ...

  9. hadoop 环境搭建

    Hadoop 2.配置HDFS HA (高可用)   前提条件 先搭建 http://www.cnblogs.com/raphael5200/p/5152004.html 的环境,然后在其基础上进行修 ...

  10. split

    import java.io.IOException; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; /** * 解析知网文章的页面 ...