#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. prototype原型属性

    <script type="text/javascript"> /* 需求:想把getMax与searchEle方法添加 到数组对象中. functoin Array( ...

  2. 模拟springmvc 内部登陆,跳过spring filter

    说明,因为我们的一个项目B使用spring mvc配置的登陆框架,所以对登陆控制全部交给了spring,导致我们如果想通过另一个项目A登陆到项目B就不太容易,具体是项目A登陆了,我们通过一个连接直接跳 ...

  3. NSSet和NSMutableSet 确保数据的唯一性--备

    NSSet和NSMutableSet是无序的, 但是它保证数据的唯一性.当插入相同的数据时,不会有任何效果.从内部实现来说是hash表,所以可以常数时间内查找一个数据. 1.NSSet的使用 [NSS ...

  4. cf D. Broken Monitor

    http://codeforces.com/contest/370/problem/D 题意:输入一张图,上面只有两个字符'w'和‘.’ ,如果可以用一个正方形把所有的‘w’围起来,所有的‘w’都在正 ...

  5. 专门讲讲这个MYSQL授权当中的with grant option的作用

    对象的owner将权限赋予某个用户(如:testuser1) grant select ,update on bd_corp to testuser1 [with grant option ]1.如果 ...

  6. 不建议用wxWidgets,底层有过多的bug

    不建议用wxWidgets, 搞了wxWidgets 3年,不是所说的那么容易跨平台,很多bug,不稳定, 莫名其妙的崩溃找源代码修改编译真是费时费力. 开发速度真没有使用本地sdk开发高, 很难定制 ...

  7. Day02_VI基本操作及C基础

    2013年09月30日 星期一 09时37分03秒 回顾:     1. linux系统的知识背景     2. vi的使用 在正常模式下使用nyy可以把光标所在行开始的连续n行拷贝到剪贴板上去 在正 ...

  8. Spring的StringUtils工具类

    本文是转载文章,感觉比较好,如有侵权,请联系本人,我将及时删除. 原文网址:<Spring的StringUtils工具类> org.springframework.util.StringU ...

  9. jQuery的基本语法

    index.html代码 <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> ...

  10. CSS常用操作-图片

    index.html <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> &l ...