nyoj 803-A/B Problem】的更多相关文章

A^B Problem 时间限制:1000 ms  |  内存限制:65535 KB 难度:2   描述 Give you two numbers a and b,how to know the a^b's the last digit number.It looks so easy,but everybody is too lazy to slove this problem,so they remit to you who is wise.   输入 There are mutiple te…
A*B Problem II 时间限制:1000 ms  |  内存限制:65535 KB 难度:1   描述 ACM的C++同学有好多作业要做,最头痛莫过于线性代数了,因为每次做到矩阵相乘的时候,大量的乘法都会把他搞乱,所以他想请你写个程序帮他检验一下计算结果是否正确.   输入 有多组测试数据,每行给出一组m,n,k(0<m,n,k<=50).m,n,k表示两个矩阵的大小,其中:矩阵A:m行n列.矩阵B:n行k列.接下来给出m*n个数表示矩阵A和n*k个数表示矩阵B,对于每个数s,0<…
点击打开链接 A+B Problem II 时间限制:3000 ms  |  内存限制:65535 KB 难度:3 描述 I have a very simple problem for you. Given two integers A and B, your job is to calculate the Sum of A + B. A,B must be positive. 输入 The first line of the input contains an integer T(1<=T<…
题目链接:http://acm.nyist.edu.cn/JudgeOnline/problem.php?pid=927 代码: #include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #include <algorithm> #include <iostream> using namespace std; int n,k; ]; ; ]…
#include<stdio.h> #include<string.h> #define ll long long #define N 110000 int main() { ll i,sum,b,k,len,f[N]; char s[N],st[3]; while(scanf("%s%s%lld",s,st,&b)!=EOF) { if(strcmp(st,"/")==0) { sum=0;len=0; for(i=0;s[i];i…
A 计划日 题意:已知李明在YYYY年MM月DD日星期W订了学习计划,现在想看看李明N天后的完成情况和个人总结,你能告诉我那天的日期和星期几吗? 模拟日期计算: 计算星期可以用基姆拉尔森公式 //中国的星期 结果要+1 int Day(int y,int m,int d) { if(m==1 || m==2) m+=12,y-=1; return (d+2*m+3*(m+1)/5+y+y/4-y/100+y/400+1)%7; } AC代码 #include<bits/stdc++.h> us…
题目链接:http://codeforces.com/problemset/problem/803/G 大致就是线段树动态开节点. 然后考虑到如果一个点还没有出现过,那么这个点显然未被修改,就将这个点所代表的区间定位到原序列中,利用ST表查一下区间最小值就可以了. 定位: llg minn(llg l,llg r) { >=n) return mt; l%=n;if(!l) l=n; r%=n;if(!r) r=n; ,r)); else return gw(l,r); } 其中${gw(l,r…
题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=860 My思路: 先用两个字符串储存这两个实数,然后再用另外两个字符串储存去掉符号和前后多余的0后的新"实数",最后只需要比较两个化简后的新字符就ok了. My代码实现: #include<iostream> using namespace std; string simplify(string s) { //去字符串s的正负号和首尾多余的0 string a; ,…
Prime Ring Problem Time Limit : 4000/2000ms (Java/Other)   Memory Limit : 65536/32768K (Java/Other) Total Submission(s) : 18   Accepted Submission(s) : 7 Problem Description A ring is compose of n circles as shown in diagram. Put natural number 1, 2,…
题目:C. Maximal GCD 题意:输入n,k.将n拆成k个数的序列,使得这k个数的gcd最大.(且序列严格递增).1 ≤ n, k ≤ 1010 . 分析:假设k个数的gcd为d,则一定有d|n,(即d一定是n的因子):遍历n所有的因子到即可.不要忘记考虑d和 的情况. 代码: /* Problem: C. Maximal GCD Time: 2017/5/4/19:29 */ #include <iostream> #include <cstdio> #include &…