链接:https://www.nowcoder.com/acm/contest/158/C 每变化一次,tot=tot*(n-1),且每两个数之差delta*=-1,直接根据这两个性质暴力循环100000次找到答案即可. 代码: #include<cstdio> #include<cstring> #include<cctype> #include<algorithm> #define int long long using namespace std; ,…
链接:https://www.nowcoder.com/acm/contest/158/C来源:牛客网 定义对 a 的再编号为 a' ,满足 . 现在有 m 次询问,每次给定 x,t ,表示询问经过 t 次再编号后第 x 个人的编号. 由于答案可能很大,所以对 109+7 取模.输入描述: 第一行 2 个数 n,m ,表示人数和询问次数: 接下来一行 n 个数,表示 ai;接下来 m 行,每行 2 个数 x,t ,描述一次询问.输出描述: m 行,第 i 行 1 个数表示第 i 次询问的答案对…
分页查询中,需要用到伪列rownum,代码如下: select * from (select rownum rn, name from cost where rownum <= 6) where rn >3; 可是第一次用rownum,第二次用rn,位置不能变,否则出错,第一次的rownum是oracle中的一个虚拟列,rn是给这个rownum起的别名,也就是在子查询中的别名要在外查询中调用.需要注意一下,就是rownum是取出一个再编号, 所以在里面我们可以写<或者<=,而不能写…
FJNU 1154 Fat Brother And His Love(胖哥与女神) Time Limit: 2000MS Memory Limit: 257792K [Description] [题目描述] As we know, fat Brother and his goddess is in a same city. The city is consist of N locations and the N locations is connected by M roads. Fat B…
ORACLE 查询一个数据表后通过遍历再插入另一个表中的两种写法 语法 第一种: 通过使用Oracle语句块 --指定文档所有部门都能查看 declare cursor TABLE_DEPT and STATUS>-; begin for c in TABLE_DEPT loop INSERT INTO G_KNOWDOCRIGHT(RID,DIRID,DOCID,USERID) VALUES(SYS_GUID(),'权限编号','文档编号',c.ID); end loop; commit;…