/* 题意:a, b两个序列,规定由[0, n]区间的数! 求 a[i] ^ b[i] 的和最大! 思路:如果数字 n的二进制有x位, 那么一定存在一个数字m,使得n^m的所有二进制位 都是1,也就是由x位1!这样下去的到的值就是最大值! */ #include<iostream> #include<cstring> #include<cstdio> #include<algorithm> #define N 100005 using namespace s…
Description There is a special number sequence which has n+1 integers. For each number in sequence, we have two rules: ● a i ∈ [0,n] ● a i ≠ a j( i ≠ j ) For sequence a and sequence b, the integrating degree t is defined as follows(“�” denotes exclus…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5014 解题报告:西安网赛的题,当时想到一半,只想到从大的开始匹配,做异或运算得到对应的b[i],但是少了一个操作,ans[i] = temp,却没有想到ans[temp] = i;所以就一直卡在这里了,因为我不确定这样是不是一一对应的,好吧,也没有想到这里,就差这么点了. #include<cstdio> #include<cstring> #include<iostream&g…
/* 题意:Nim游戏! 思路:通过异或,判断将n个数表示成二进制的形式之后,是否对应位的数字1 的个数是偶数! */ #include<iostream> using namespace std; int main(){ int n, x, s; while(cin>>n){ s=; while(n--){ cin>>x; s^=x; } if(s) cout<<"Win";//不是偶数 else cout<<"L…
为了a异或b的和最大,只需另b在不大于n的情况下按位取反即可. 这里有两个输出小技巧可以参考: 1.在用printf输出__int64时,在windows下使用格式"%I64d",在linux下使用"%lld",在hdu中应使用"%I64d",如果拿不准就是用cout好了. 2.在遇到每个数之间有空格,最后一个数后面是换行时可以使用这个小技巧: ; i < n; i++ ) printf(? '\n' : ' ')); 完整代码如下: #d…
题意:求n个'M'型的折线将一个平面分成的最多的面数! 思路:我们都知道n条直线将一个平面分成的最多平面数是 An = An-1 + n+1 也就是f(n) = (n*n + n +2)/2 对于一个'M'型的折线呢?它有四条线,但是由于三个顶点的关系导致划分的平面 的数目减少了9个!所以有递推公式 f(n) = (m*m + m + 2)/2 - 9*n; m = 4*n 最后 f(n) = (8*n+1)*(n-1)+2) 由于 n<=1e12 , 所以回报 long long!那么对于大于…
题意:从任意一个任意一个可走的点开始找一个最长的路,这条路如果有转弯的话, 那么必须是 90度,或者没有转弯! 思路: 首先用dfs将所有可走点开始的 8 个方向上的线段的最长长度求出来 ! step[i][j][k] 表示的是(i,j)沿着k方向一直走到头或者转弯时的最长步数! 最后枚举每一个可走点转弯为90度的路径,找到最长的长度! step[i][j][k1] + step[i][j][k2] 就是 (i, j)这个点 k1 和 k2方向构成90度! #include<iostream>…
/* 这是我做过的一道新类型的搜索题!从来没想过用四维数组记录状态! 以前做过的都是用二维的!自己的四维还是太狭隘了..... 题意:悟空救师傅 ! 在救师父之前要先把所有的钥匙找到! 每种钥匙有 k 种, 每一种有多个! 只要求找到每一种的其中一个就可以! 找钥匙的顺序按照 第1种, 第2种, 第3种 ....第k种! 找钥匙的时间是一步, 走到相邻空地的时间是一步, 打蛇的时间就是两步! 求找到师傅的最少步数! 这里说一下 state[N][N][10][35]表示的含义: ->state[…
#include<iostream> #include<cstring> #include<cstdio> #include<algorithm> #define N 1000005 using namespace std; ]; ];//正值表示该节点所管理的区间的颜色是纯色,-1表示的是非纯色 int n, m; void buildT(int ld, int rd, int p){ if(ld <= rd){ tree[p] = ;//初始每一个…
/* 题意:就是给定两个筛子,每个筛子上6个面,每个面的数字属于[1,6], 且互不相同! 问a筛子最少经过按照题目规定的要求转动,达到和b筛子上下左右前后的数字相同! 思路:很直白的bfs,将每一种状态对应一个数字,保证这种状态不会重新加入队列中! */ #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<queue> using…
//暴力,从每一行的开始处开始寻找要查询的字符 #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> using namespace std; ]; int main(){ while(gets(str)){ ; str[i]; ++i) if(str[i]=='A'){ if(strstr(str+i, "Apple") == str+i) p…
Number Sequence Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Problem Description There is a special number sequence which has n+1 integers. For each number in sequence, we have two rules: ● a i ∈ [0,n] ● a i ≠ a j ( i…
There is a special number sequence which has n+1 integers. For each number in sequence, we have two rules: ● a i ∈ 0,n0,n ● a i ≠ a j( i ≠ j ) For sequence a and sequence b, the integrating degree t is defined as follows("�" denotes exclusive or…
AX2012的number sequence framework中引入了两个Scope和segment两个概念,它们的具体作用从下面序列的例子说起. 法国/中国的法律要求财务凭证的Journal number包含公司代码和财务期间,比如这样的号码J-20-Jan11-000340,J表上Journal,20代表的是公司代码,Jan11为财务期间,000340才是系统生成的流水号. 在创建Numer sequence的界面上可以选择需要的Scope: Company and fiscal cale…
Number Sequence DescriptionA single positive integer i is given. Write a program to find the digit located in the position i in the sequence of number groups S1S2...Sk. Each group Sk consists of a sequence of positive integer numbers ranging from 1 t…
Number Sequence Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 154923    Accepted Submission(s): 37854 Problem Description A number sequence is defined as follows: f(1) = 1, f(2) = 1, f(n) = (A…
找规律,先找属于第几个循环,再找属于第几个数的第几位...... Number Sequence Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 31552 Accepted: 8963 Description A single positive integer i is given. Write a program to find the digit located in the position i in the sequ…
Number Sequence Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 8600    Accepted Submission(s): 3953 Problem Description Given two sequences of numbers : a[1], a[2], ...... , a[N], and b[1], b[…
Number Sequence   A number sequence is defined as follows: f(1) = 1, f(2) = 1, f(n) = (A * f(n - 1) + B * f(n - 2)) mod 7. Given A, B, and n, you are to calculate the value of f(n).   Input The input consists of multiple test cases. Each test case co…
Number Sequence Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 11606    Accepted Submission(s): 5294 Problem Description Given two sequences of numbers : a[1], a[2], ...... , a[N], and b[1], b…
Number Sequence Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 89984    Accepted Submission(s): 21437 Problem Description A number sequence is defined as follows: f(1) = 1, f(2) = 1, f(n) = (A…
Number Sequence Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 124827 Accepted Submission(s): 30331 Problem Description A number sequence is defined as follows: f(1) = 1, f(2) = 1, f(n) = (A * f(…
HDU 1711 Number Sequence(数列) Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) [Description] [题目描述] Given two sequences of numbers : a[1], a[2], ...... , a[N], and b[1], b[2], ...... , b[M] (1 <= M <= 10000, 1 <= N…
HDU 1005 Number Sequence(数列) Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) [Description] [题目描述] A number sequence is defined as follows: f(1) = 1, f(2) = 1, f(n) = (A * f(n - 1) + B * f(n - 2)) mod 7. Given A, B, an…
Number Sequence Time Limit: 10000/3000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Problem Description Given a number sequence b1,b2…bn. Please count how many number sequences a1,a2,...,an satisfy the condition that a1*a2*...*an=b1*…
Number Sequence Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 86102 Accepted Submission(s): 20423 Problem Description A number sequence is defined as follows: f(1) = 1, f(2) = 1, f(n) = (A * f(n…
Suppose we want create number sequence for Test field on form in General  ledger module Consideration: EDT-Test, Table-TestTable and Form- TestTable   Step1. Create new EDT with name Test Step 2. Modify load module() method on  NumberSeqModuleLedger…
Yet Another Number Sequence Description Everyone knows what the Fibonacci sequence is. This sequence can be defined by the recurrence relation: F1 = 1, F2 = 2, Fi = Fi - 1 + Fi - 2 (i > 2). We'll define a new number sequence Ai(k) by the formula: Ai(…
Number Sequence Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 9058    Accepted Submission(s): 4149 Problem Description Given two sequences of numbers : a[1], a[2], ...... , a[N], and b[1], b[…
Problem B Number Sequence Input: standard input Output: standard output Time Limit: 1 second A single positive integer i is given. Write a program to find the digit located in the position i in the sequence of number groups S1S2…Sk. Each group Sk con…