09 2015 档案
摘要:printf("%02d:%02d:%02d\n", h, m, s);因为这个格式WA了。 让mm++,hh++比分析m,h是否为零简单。 #include int main() { int h, m, s, hh, mm, ss; int n; scanf("%d", &n); while...
阅读全文
摘要:#include #include #include int main(){ int n,m,a[30][30],i,j,max,flag_i,flag_j,sum; while(~scanf("%d%d",&n,&m) && (n||m)) { memset(a...
阅读全文
摘要:一个n*m的矩形, 当n=1时,即只有一列:一个一个地数,有m个;二个二个地数,有m-1个;。。。;m个m个地数,有1个。所以就有(1+m)*m / 2个。 当m=1时,即只有一行:一个一个地数,有n个;二个二个地数,有n-1个;。。。;n个n个地数,有1个。所以就有(1+n)*n / 2...
阅读全文
摘要:const 成员函数的声明看起来怪怪的:const 关键字只能放在函数声明的尾部,大概是因为其它地方都已经被占用了。 任何不会修改数据成员(即函数中的变量)的函数都应该声明为const 类型。 const对象默认调用const成员函数,非const对象默认调用非const成员函数; ...
阅读全文
摘要:看到const关键字,程序员首先想到的可能是const 常量。 const 更大的魅力是它可以修饰函数的参数、返回值,甚至函数的定义体。 const 是constant 的缩写,“恒定不变”的意思。被const 修饰的东西都受到强制保护,可以预防意外的变动,能提高程序的健壮性。所以很多C+...
阅读全文
摘要:/* 公式:n*(n+1)*(n+2)/6 输入要是__int64,否则报错 */ #include int main(){ int t; __int64 n,s; for(scanf("%d",&t);t--;){ scanf("%I64d",&n); ...
阅读全文
摘要:此题不懂,为什么是2*d[i-1] + d[i-2] #include #include using namespace std;int result[40];int main(){ int C, n; result[1] = 3; result[2] = 9; for (int i=3...
阅读全文
摘要:d[900] = 1180945252 d[899] = 451945252 #include int main(){ int d[902]={0}, x; int t, i; for(i=1; i<902; i++) d[i] = d[i-1] + i * i * i; sc...
阅读全文
摘要:这种方法不知道哪里错了,待查。 #include int main(){ int t, n, i, x; double d; scanf("%d", &t); while(t--){ scanf("%lf%d", &d, &n); for(i=0; i#include...
阅读全文
摘要:#include int main(){ int t; double u, v, w, l; scanf("%d", &t); while(t--){ scanf("%lf%lf%lf%lf", &u, &v, &w, &l); printf("%.3lf\n", l...
阅读全文
摘要:#include int main(){ int n, w, d, sum, ans, t; while(~scanf("%d%d%d%d", &n, &w, &d, &t)){ sum = n * (n-1) / 2 * w; ans = (sum - t) / d; ...
阅读全文
摘要:这样的水题做他干嘛,我还提交5次才ac,马丹,我是来读英语来了 #include int main(){ int n; long a, b, c; scanf("%d", &n); while(n--){ scanf("%ld%ld%ld", &a, &b, &c); if(b-c>a) p...
阅读全文
摘要:#include int main(){ int t, i, sum, num, n; scanf("%d", &t); while(t--){ scanf("%d", &n); sum = 0; for(i=0; i<n; i++){ ...
阅读全文
摘要:min需要写为1000,写成0不行。fuck,#include #include int main(){ int n, max, min, i, num ,sum; while(~scanf("%d", &n)){ if(n==0) break; max = 0; ...
阅读全文
摘要:#include #include using namespace std;int main(){ int n, d[10001], i=0; while(~scanf("%d", &n)){ for(i=0; i<n; i++) scanf("%d", &d[i]); sor...
阅读全文
摘要:想用map做,无奈不怎么会map,我也是几天前才看了map。自己写的错误代码如下。 #include #include #include using namespace std;int main() { map char_count; string s; int i; ...
阅读全文
摘要:开始用递归总是超时,后来发现每 7 一循环,不过要根据 f [3] 把0, 1, 2, 3, 4, 5, 6的次序改了,但这样我写不出来,后来百度说49一循环,解决了。 #include using namespace std;int main(){ int a,b; long in...
阅读全文
摘要:可以推导出:A1 = n / (n + 1) * A0 + 1 / (n + 1)* An+1 - 2*n / (n + 1)* C1 - (2*n - 2)/(n + 1)* C2 - ........2 / (n + 1)* Cn-1。 #include #include using nam...
阅读全文

浙公网安备 33010602011771号