AT994 【11の倍数】】的更多相关文章

超短AC代码压行小技巧 #include<iostream> using namespace std; string s; ]; int main() { cin>>s; int l=s.length(); ;i<l;i++) ans[(l-i)&]+=s[i]-'; cout<<ans[]<<]<<endl; ; }…
1.#一个四位数,各位数字互不相同,所有数字之和等于6,并且这个数是11的倍数,#则满足这种要求的四位数有多少个? 代码如下: # -*- coding: UTF-8 -*-import systype = sys.getfilesystemencoding() #字符串转为int 转换为浮点数 string.atof(tt) def strzhuangint(strs): return string.atoi(strs) #比较list 中是否字符串相等 -1代表有相等的 1,代表不想等 de…
HashTable Easy 1. 136. Single Number 0与0异或是0,1与1异或也是0,那么我们会得到0 class Solution { public: int singleNumber(vector<int>& nums) { ; for( auto num : nums) res ^= num; return res; } }; 2. 202. Happy Number 用 HashSet 来记录所有出现过的数字,然后每出现一个新数字,在 HashSet 中查…
Largest palindrome product   A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99. Find the largest palindrome made from the product of two 3-digit numbers. 寻找能够分解为两个三位数乘…
Java JUC之Atomic系列12大类实例讲解和原理分解 2013-02-21      0个评论       作者:xieyuooo 收藏    我要投稿 在java6以后我们不但接触到了Lock相关的锁,也接触到了很多更加乐观的原子修改操作,也就是在修改时我们只需要保证它的那个瞬间是安全的即可,经过相应的包装后可以再处理对象的并发修改,以及并发中的ABA问题,本文讲述Atomic系列的类的实现以及使用方法,其中包含: 基本类:AtomicInteger.AtomicLong.Atomic…
/*Navicat MySQL Data Transfer Source Server : localhostSource Server Version : 50136Source Host : localhost:3306Source Database : ben500_info Target Server Type : MYSQLTarget Server Version : 50136File Encoding : 65001 Date: 2013-07-11 10:07:33*/ SET…
1.找出1~5000范围内分别满足如下条件的数: (1) 7或11或13的倍数 (2) 7.11,或7.13或11.13的倍数 (3) 7.11和13的倍数. package chapter3; public class demo1 { public static void main(String[] args) { for(int i=1;i<=5000;i++) { if(i%7==0||i%11==0||i%13==0) { System.out.print(i+" ");…
题意:告诉一个数n,然后求出所有的位数和,插在n的尾部,重复求t次,判断最终的数是否能被11整除. 分析:直接模拟的过程,并且模拟的除的过程,却TLE,以为是方法错了,因为每次都得循环求一遍位数和: PS: 1.能被11整除:就是求偶数位和-奇数位和的差,如果差能被11整除,就是能够被11整除.比如35816, 3 - 5 + 8 - 1 + 6 = 11,能被11整除: 2.能被7整除:若一个整数的个位数字截去,再从余下的数中,减去个位数的2倍,如果差是7的倍数,则原数能被7整除.比如133,…
Doubles Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 19954   Accepted: 11536 Description As part of an arithmetic competency program, your students will be given randomly generated lists of from 2 to 15 unique positive integers and as…
c++11还增加了许多有用的特性,比如: 1. 委托构造函数 如果一个类含有很多构造函数,这些构造函数有一些重复的地方,比如: class A{ public: A(){}; A(int a){ a_ = a; }; A(int a, int b){ a_ = a; b_ = b; }; A(int a, int b, double c){ a_ = a; b_ = b; c_ = c; }; private: int a_; int b_; double c_; } 类A的三个构造函数有重复,…