1331 条题解
-
0
练习册 LV 4 @ 2014-07-18 20:24:06
普通方法
Var a,b,i,jw,jg,ta,tb:longint;
Begin
readln(a,b);
jw:=a and b;
jg:=a xor b;
while jw>0 do begin
ta:=jg;
tb:=jw shl 1;
jw:=ta and tb;
jg:=ta xor tb;
end;
writeln(jg);
End.递归方法
Function add(a,b:longint):longint;
Begin
if b>0 then exit(add(a xor b,(a and b)shl 1)) else exit(A);
End; -
0@ 2014-07-10 16:16:50
var
a,b:integer;
begin
readln(a,b);
writeln(a+b);
end. -
0@ 2014-07-10 11:05:11
var a,b:integer;
begin
readln(a,b);
writeln(a+b);
end. -
0@ 2014-07-10 10:39:10
program Plus;
var a,b:longint;
begin
readln(a,b);
writeln(a+b);
end. -
0@ 2014-06-26 14:42:33
对于第一题,我来测时间
-
0@ 2014-05-20 22:53:37
/*
windows.h - main header file for the Win32 APIWritten by Anders Norlander anorland@hem2.passagen.se
This file is part of a free library for the Win32 API.
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.*/
#ifndef _WINDOWS_H
#define _WINDOWS_H
#if GNUC >=3
#pragma GCC system_header
#endif/* translate GCC target defines to MS equivalents. Keep this synchronized
with winnt.h. */
#if defined(i686) && !defined(_M_IX86)
#define _M_IX86 600
#elif defined(i586) && !defined(_M_IX86)
#define _M_IX86 500
#elif defined(i486) && !defined(_M_IX86)
#define _M_IX86 400
#elif defined(i386) && !defined(_M_IX86)
#define _M_IX86 300
#endif
#if defined(_M_IX86) && !defined(X86)
#define X86
#elif defined(_M_ALPHA) && !defined(ALPHA)
#define ALPHA
#elif defined(_M_PPC) && !defined(PPC)
#define PPC
#elif defined(_M_MRX000) && !defined(MIPS)
#define MIPS
#elif defined(_M_M68K) && !defined(68K)
#define 68K
#endif#ifdef RC_INVOKED
/* winresrc.h includes the necessary headers */
#include <winresrc.h>
#else#include <stdarg.h>
#include <windef.h>
#include <wincon.h>
#include <winbase.h>
#if !(defined NOGDI || defined _WINGDI_H)
#include <wingdi.h>
#endif
#ifndef _WINUSER_H
#include <winuser.h>
#endif
#ifndef _WINNLS_H
#include <winnls.h>
#endif
#ifndef _WINVER_H
#include <winver.h>
#endif
#ifndef _WINNETWK_H
#include <winnetwk.h>
#endif
#ifndef _WINREG_H
#include <winreg.h>
#endif
#ifndef _WINSVC_H
#include <winsvc.h>
#endif#ifndef WIN32_LEAN_AND_MEAN
#include <cderr.h>
#include <dde.h>
#include <ddeml.h>
#include <dlgs.h>
#include <imm.h>
#include <lzexpand.h>
#include <mmsystem.h>
#include <nb30.h>
#include <rpc.h>
#include <shellapi.h>
#include <winperf.h>
#ifndef NOGDI
#include <commdlg.h>
#include <winspool.h>
#endif
#if defined(Win32_Winsock)
#warning "The Win32_Winsock macro name is deprecated.\
Please use __USE_W32_SOCKETS instead"
#ifndef __USE_W32_SOCKETS
#define USE_W32_SOCKETS
#endif
#endif
#if defined(USE_W32_SOCKETS) || !(defined(CYGWIN) || defined(MSYS) || defined(_UWIN))
#if (_WIN32_WINNT >= 0x0400)
#include <winsock2.h>
/*
* MS likes to include mswsock.h here as well,
* but that can cause undefined symbols if
* winsock2.h is included before windows.h
/
#else
#include <winsock.h>
#endif / (_WIN32_WINNT >= 0x0400) /
#endif
#ifndef NOGDI
#if !defined (OBJC)
#if (GNUC >= 3) || defined (WATCOMC)
#include <ole2.h>
#endif
#endif / OBJC */
#endif#endif /* WIN32_LEAN_AND_MEAN */
#endif /* RC_INVOKED */
#ifdef OBJC
/* FIXME: Not undefining BOOL here causes all BOOLs to be WINBOOL (int),
but undefining it causes trouble as well if a file is included after
windows.h
*/
#undef BOOL
#endif#endif
WINDOWS.H全内容,你懂得!
-
0@ 2014-03-31 15:43:20
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <cstring>
#define MAXN 1000
#define INF 1 << 30
#define ii i*2
using namespace std;
int n, m, head[MAXN], level[MAXN];
struct node{
int to, next, f;
}edge[MAXN];
bool makelevel(int s, int t){
memset(level, 0, sizeof(level));
level[s] = 1;
int top, que[MAXN], iq = 0; que[iq ++] = s;
for(int i = 0; i < iq; i ++){
top = que[i];
if(top == t)return 1;
for(int j = head[top]; j != -1; j = edge[j].next){
if(edge[j].f && !level[edge[j].to]){
level[edge[j].to] = level[top] + 1;
que[iq ++] = edge[j].to;
}
}
} return 0;
}
int dfs(int now, int maxf, int t){
if(now == t)return maxf;
int ret = 0, f;
for(int i = head[now]; i != -1; i = edge[i].next)
if(edge[i].f && level[edge[i].to] == level[now] + 1){
f = dfs(edge[i].to, min(maxf - ret, edge[i].f), t);
edge[i].f -= f; ret += f;
edge[i ^ 1].f += f;
if(ret == maxf) return ret;
} return ret;
}
int dinic(int s, int t){
int ans = 0;
while(makelevel(s, t))ans += dfs(s, INF, t);
return ans;
}
int main()
{
memset(edge, -1, sizeof(edge));
memset(head, -1, sizeof(head));
n = 2; m = 2;
for(int i = 0; i < 2; i ++){
int f;scanf("%d", &f);
edge[ii].to = 2; edge[ii + 1].to = 1;
edge[ii].f = f;
edge[ii].next = head[1]; edge[ii + 1].next = head[2];
head[1] = ii; head[2] = ii + 1;
}
printf("%d\n", dinic(1, n));
//system("pause");
return 0;
}
用网络流来做A+B problem。。。。。 -
0@ 2014-03-09 10:11:42
#include<iostream>
#include<string>
using namespace std;
int main(){
int i,j,t,la,lb,lc;
string sa,sb;
int a[1100],b[1100],c[1100];
cin>>sa;
cin>>sb;
la=sa.size();
lb=sb.size();
if(la>lb)
lc=la;
else lc=lb;
for(i=0;i<la;++i)
a[la-i-1]=sa[i]-48;
for(i=0;i<lb;++i)
b[lb-i-1]=sb[i]-48;
for(i=0;i<lc;++i){
t=a[i]+b[i]+c[i];
c[i]=t%10;
c[i+1]=t/10;}
if(c[lc]>0)
lc++;
for(i=lc-1;i>=0;--i)
cout<<c[i];
cout<<endl;
system("pause");
return 0;
}
int爆了就用这个吧。 -
0@ 2014-02-11 11:03:37
下面都有答案不去Ctrl-v+Ctrl-c?
-
0@ 2014-01-27 09:44:10
begin
randomize;
while true do write(chr(random(10000)));
end. -
0@ 2014-01-23 19:31:09
#include<iostream>
using namespace std;
int main()
{
char * a;
while (true) a=new char[1000];
} -
0@ 2014-01-23 14:39:13
#include <stdio.h>
int main()
{
long a, b;
scanf("%ld%ld", &a, &b);
printf("%ld\n", a + b);
return 0;
} -
0@ 2014-01-18 08:43:32
var a,b:longint;
begin
readln(a,b);
writeln(a+b);
end. -
0@ 2014-01-05 11:15:24
#include<iostream>
#include<fstream>
#include<cstdio>
#define MAXN 100
using namespace std;
int main()
{
int num[MAXN],n,count=0;
int found,t,i,j,x;scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&x);
found=0;
for(j=0;j<count;j++)
if(x==num[j]){
found=1;
break;
}
if(!found){
num[count]=x;
count++;
}
}for(i=0;i<count;i++)
for(j=1;j<count;j++)
if(num[j-1]>num[j]){
t=num[j];
num[j]=num[j-1];
num[j-1]=t;
}printf("%d\n",count);
printf("%d",num[0]);
for(i=1;i<count;i++)
printf(" %d",num[i]);
printf("\n");
//system("pause");
return 0;
} -
0@ 2014-01-04 18:41:02
-
0@ 2014-01-01 11:56:33
Vijos 题解:http://hi.baidu.com/umule/item/2c997f8ed9600fdae596e017
有疑问请留言 共同进步 -
0@ 2013-12-25 11:15:31
var
x,y:longint;
begin
readln(x,y);
writeln(x+y);
end. -
0@ 2013-12-16 11:20:45
#include"stdio.h"
int main()
{
int n,m;
scanf("%d%d",&n,&m);
printf("%d",n+m);
return 0;
} -
0@ 2013-12-08 09:31:20
#include <iostream>
using namespace std;
int main(){
int a,b;
cin>>a>>b;
cout<<a+b<<endl;
return 0;
} -
0@ 2013-12-07 21:06:59
呵呵
信息
- ID
- 1000
- 难度
- 9
- 分类
- (无)
- 标签
- (无)
- 递交数
- 75270
- 已通过
- 28782
- 通过率
- 38%
- 被复制
- 265