1330 条题解
-
0
mhjk LV 3 @ 2009-08-03 12:14:50
#include
using namespace std;
int main(){
int a,b;
cin>>a>>b;
cout -
0@ 2009-08-02 16:59:10
编译通过...
├ 测试数据 01:Vivid Puppy评测机故障... 32723ms
├ 测试数据 02:Vivid Puppy评测机修理中... 34223ms
├ 测试数据 03:选择其他机器... 3999ms
├ 测试数据 04:Vijos Dragon评测机启动... 1234ms
├ 测试数据 05:紫田漯河双线机房跳电... 1ms
├ 测试数据 06:Vijos Dragon评测机硬件故障... 32323ms
├ 测试数据 07:Vijos Dragon评测机修理中... 32201ms
├ 测试数据 08:Vag 6K评测机启动...4321ms
├ 测试数据 09:Vag 6K评测机安装Free Pascal IDE中... 429421ms
├ 测试数据 10:Vag 6K评测机故障... 142ms
---|---|---|---|---|---|---|---|-
unaccepted 有效得分:0 有效耗时:560588ms -
0@ 2009-08-17 09:43:44
// Standard iostream objects -*- C++ -*-
// Copyright (C) 1997, 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.//
// ISO C++ 14882: 27.3 Standard iostream objects
///** @file iostream
* This is a Standard C++ Library header. You should @c #include this header
* in your programs, rather than any of the "st[dl]_*.h" implementation files.
*/#ifndef _GLIBCXX_IOSTREAM
#define _GLIBCXX_IOSTREAM 1#pragma GCC system_header
#include
#includenamespace std
{
/**
* @name Standard Stream Objects
*
* The header declares the eight standard stream
* objects. For other declarations, see
* http://gcc.gnu.org/onlinedocs/libstdc++/27_io/howto.html#10 and the
* @link s27_2_iosfwd I/O forward declarations @endlink
*
* They are required by default to cooperate with the global C library's
* @c FILE streams, and to be available during program startup and
* termination. For more information, see the HOWTO linked to above.
*/
//@{
extern istream cin; ///< Linked to standard input
extern ostream cout; ///< Linked to standard output
extern ostream cerr; ///< Linked to standard error (unbuffered)
extern ostream clog; ///< Linked to standard error (buffered)#ifdef _GLIBCXX_USE_WCHAR_T
extern wistream wcin; ///< Linked to standard input
extern wostream wcout; ///< Linked to standard output
extern wostream wcerr; ///< Linked to standard error (unbuffered)
extern wostream wclog; ///< Linked to standard error (buffered)
#endif
//@}// For construction of filebuffers for cout, cin, cerr, clog et. al.
static ios_base::Init __ioinit;
} // namespace std#endif /* _GLIBCXX_IOSTREAM */
using namespace std;
int main()
{
int a,b;
cin>>a>>b;
cout -
0@ 2009-07-31 17:11:22
#include
using namespace std;
int main(){
int a,b;
cin>>a>>b;
cout -
0@ 2009-07-31 08:53:44
var a,b,c:longint;
begin
read(a,b);
c:=a+b;
write(c);
end. -
0@ 2009-07-30 13:27:19
program sum;
var
x,y,z:integer;
begin
read(x,y);
z:=x+y;
write(z)
end. -
0@ 2009-07-28 22:32:19
.....无语
-
0@ 2009-07-28 19:36:46
program exam1;
var a,b,c:integer;
begin
read(a,b);
c:=a+b;
write(c);
end. -
0@ 2009-07-27 09:15:07
var a,b:longint;
begin
readln(a,b);
writeln(a+b);
end.^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
这种做法是极其不可取的…… -
0@ 2009-07-26 23:10:10
#include
int main(void)
{
int a,b,c;
scanf("%d,%d",&a,&b);
printf("a+b=%d",a+b");
return 0;
} -
0@ 2009-07-26 22:21:47
娃哈哈呀娃哈哈呀,每个人脸上都笑开颜.....
用random然后打表.......
编译通过...
├ 测试数据 01:答案不正确... 999ms
├ 测试数据 02:答案好像正确... 999ms
├ 测试数据 03:答案似乎正确... 999ms
├ 测试数据 04:答案可能正确... 999ms
├ 测试数据 05:答案不能确定... 999ms
├ 测试数据 06:无答案... 999ms
├ 测试数据 07:运行超时... 999ms
├ 测试数据 08:答案失眠... 999ms
├ 测试数据 09:答案休息中... 999ms
├ 测试数据 10:答案不存在... 999ms
---|---|---|---|---|---|---|---|-
不能确定 有效得分:0 有效耗时:999牌感冒灵ms -
0@ 2009-09-02 19:32:12
【思路】 by cjf00000
此题考查动态规划思想
首先我们需要把输入字符转换为数字a,b 然后使用动态规划求解A+B的值 最后输出答案
我们可以设计出如下DP方程
令f[j]表示i+j的值 则有
1. f[0][0]=0
2. f[j]=max
3. { f[j]+1,
4. f[i][j-1]+1 }
由于对于每个i,j我们都要计算出f[j],因此时间复杂度与空间复杂度都为O(n^2)
但是 对于题目提供的最大数字n=32767明显超时!
【优化1】by wusu5545
对于DP方程 由于每次计算只需要f[j]或f[j-1]
因此我们可以使用滚动数组优化DP的空间复杂度
使用两个整数x,y分别保存f[j]与f[j-1]
空间复杂度降为O(2) 然而时间复杂度O(n^2)仍然超时!
“时间复杂度,到目前为止还没有更好的优化方法。因此,此题被称为史上最难的dp题!”
【优化2】by 匿名大牛
对于整数的运算 我们可以利用位运算的思想简化复杂度
题目显然要我们求两非负整数之和。
我们知道,在非负整数加法的二进制逻辑运算中,每一位上的结果取决于以下两方面:
1、本位上两个逻辑位的异或值
2、后一位的结果是否溢出
利用这种性质,可以考虑如下做法:
令f[j]表示,考虑两个加数的后i、j位相加的结果,显然有以下状态转移方程
1. f[j]= max
2. { f[i][j-1]+y & (1 -
0@ 2009-07-25 09:42:45
var
a,h,i,j,k,l:integer;
b:array[1..100] of string;
c,d,e:array[1..100] of integer;
f,g:array[1..100] of char;
m:array[1..101] of longint;
begin
readln(a);
for h:=1 to a do
readln(b[h]);
for h:=1 to a do
begin
i:=1;
b[h]:=b[h]+' ';
while b[h,i]' ' do
i:=i+1;
j:=i-1;
i:=i+1;
while b[h,i]' ' do
begin
c[h]:=c[h]*10+ord(b[h,i])-48;
i:=i+1;
end;
i:=i+1;
while b[h,i]' ' do
begin
d[h]:=d[h]*10+ord(b[h,i])-48;
i:=i+1;
end;
i:=i+1;
f[h]:=b[h,i];
i:=i+2;
g[h]:=b[h,i];
i:=i+2;
while b[h,i]' ' do
begin
e[h]:=e[h]*10+ord(b[h,i])-48;
i:=i+1;
end;
b[h]:=copy(b[h],1,j);
end;
i:=0;
for h:=1 to a do
begin
if (c[h]>80) and (e[h]>0) then
m[h]:=m[h]+8000;
if (c[h]>85) and (d[h]>80) then
m[h]:=m[h]+4000;
if c[h]>90 then
m[h]:=m[h]+2000;
if (c[h]>85) and (g[h]='Y') then
m[h]:=m[h]+1000;
if (d[h]>80) and (f[h]='Y') then
m[h]:=m[h]+850;
m[101]:=m[101]+m[h];
if m[h]>i then
begin
i:=m[h];
j:=h;
end;
end;
writeln(b[j]);
writeln(i);
writeln(m[101]);
end.
这是1001 -
0@ 2009-07-24 14:58:27
var
a,b,c:word;
begin
read(a,b);
c:=a+b;
write(c);
end.
终于AC了 交了五次..我叫张信豪。。谢谢..
-
0@ 2009-07-24 11:18:14
program ayqzwu110;
var a,b:longint;
begin
readln(a,b);
writeln(a+b);
end. -
0@ 2009-07-24 10:11:05
program ab;
var a,b:longint;
begin
read(a,b);
write(a+b);
end. -
0@ 2009-07-25 10:52:17
var
a,h,i,j,k,l:integer;
b:array[1..100] of string;
c,d,e:array[1..100] of integer;
f,g:array[1..100] of char;
m:array[1..101] of longint;
begin
readln(a);
for h:=1 to a do
readln(b[h]);
for h:=1 to a do
begin
i:=1;
b[h]:=b[h]+' ';
while b[h,i]' ' do
i:=i+1;
j:=i-1;
i:=i+1;
while b[h,i]' ' do
begin
c[h]:=c[h]*10+ord(b[h,i])-48;
i:=i+1;
end;
i:=i+1;
while b[h,i]' ' do
begin
d[h]:=d[h]*10+ord(b[h,i])-48;
i:=i+1;
end;
i:=i+1;
f[h]:=b[h,i];
i:=i+2;
g[h]:=b[h,i];
i:=i+2;
while b[h,i]' ' do
begin
e[h]:=e[h]*10+ord(b[h,i])-48;
i:=i+1;
end;
b[h]:=copy(b[h],1,j);
end;
i:=0;
for h:=1 to a do
begin
if (c[h]>80) and (e[h]>0) then
m[h]:=m[h]+8000;
if (c[h]>85) and (d[h]>80) then
m[h]:=m[h]+4000;
if c[h]>90 then
m[h]:=m[h]+2000;
if (c[h]>85) and (g[h]='Y') then
m[h]:=m[h]+1000;
if (d[h]>80) and (f[h]='Y') then
m[h]:=m[h]+850;
m[101]:=m[101]+m[h];
if m[h]>i then
begin
i:=m[h];
j:=h;
end;
end;
writeln(b[j]);
writeln(i);
writeln(m[101]);
end.
1001的题解!!!!! -
0@ 2009-07-23 16:28:56
program ex_1;
var
a,b:longint;
begin
read(a+b);
writeln(a+b);
readln;
end. -
0@ 2009-07-23 11:36:19
program ex1;
var
a,b:longint;
begin
read(a,b);
write(a+b);
end. -
0@ 2009-07-22 18:22:16
hgdh dfhdfhdfh
信息
- ID
- 1000
- 难度
- 9
- 分类
- (无)
- 标签
- (无)
- 递交数
- 75231
- 已通过
- 28774
- 通过率
- 38%
- 被复制
- 265