uva 10994 - Simple Addition(规律)】的更多相关文章

题目链接:uva 10994 - Simple Addition 题目大意:给出l和r,求∑(l≤i≤r)F(i), F(i)函数题目中有. 解题思路:由两边向中间缩进,然后l和r之间的数可以按照1~9划分(只会有这几种情况). #include <stdio.h> #define ll long long ll ans; ll f(ll x) { if (x == 0) return 0; else if (x % 10) return x % 10; else return f(x / 1…
Problem E Simple Addition Input: Standard Input Output: Standard Output Let’s define a simple recursive function F (n), where Let’s define another function S (p, q), In this problem you have to Calculate S (p, q) on given value of   p and q.   Input…
//组合数学 //计算sum{i从右往左数的第一个非0数字,p<=i<=q}. #include <cstdio> typedef long long ll; ll sum(ll n) { ll ans = , x; while(n) { x = n % ; n /= ; ans += (( + x) * x) / + n * ; //当个位在循环的时候,高位的朋友你在干嘛? } return ans; } int main() { ll a, b; ) { printf());…
hdu 2451 Simple Addition Expression Problem Description A luxury yacht with 100 passengers on board is sailing on the sea in the twilight. The yacht is ablaze with lights and there comes out laughers and singing from the hall where an evening party i…
题目链接:uva 12253 - Simple Encryption 题目大意:给定K1.求一个12位的K2,使得KK21=K2%1012 解题思路:按位枚举,不且借用用高速幂取模推断结果. #include <cstdio> #include <cstring> #include <algorithm> using namespace std; typedef long long ll; const ll ite=(1<<20)-1; ll N; /* l…
主题链接:http://acm.hdu.edu.cn/showproblem.php?pid=2451 Problem Description A luxury yacht with 100 passengers on board is sailing on the sea in the twilight. The yacht is ablaze with lights and there comes out laughers and singing from the hall where an…
Problem Description A luxury yacht with 100 passengers on board is sailing on the sea in the twilight. The yacht is ablaze with lights and there comes out laughers and singing from the hall where an evening party is in full swing. People are singing,…
UVA - 10014 Simple calculations Time Limit: 3000MS Memory Limit: Unknown 64bit IO Format: %lld & %llu id=19100" style="color:blue">Submit Status Description  Simple calculations  id=19100" style="color:blue">The Pro…
[来源] 2008年哈尔滨区域赛 [题目链接]: http://acm.hdu.edu.cn/showproblem.php?pid=2451 [参考博客]: HDU 2451 Simple Addition Expression [题意]: 题意是要判断前n位数字(不包括n),有多少个数字 i 跟前面两个 i+1 , i+2 ,相加时不进位 . 符合要求的数字就是个位 0 ~ 2 ,其余位 0 ~ 3. 用一个dfs就可以搜出来了. 对于当前位是 x 的话 , 若果 x > 3 , 可以直接得…
题目 最近比赛的题目好多签到题都是找规律的考验智商的题目啊,,,我怎么越来越笨了,,,, 通过列举,可以发现规律: 从左往右按位扫这个数: 当数的长度大于1时: 当首位大于3时,答案就是4*4*4*……*4*3(即pow(4,后面的长度-1)*3): 否则,则是 首位的数字*4*4*4*……*4*3: 当数的长度为1时,并且之前的(即其他的)都没有进位,则直接判断一下ans要加多少个: #include<stdio.h> #include<string.h> #include<…