这题是二分+2SAT.总结一下SAT题的特征。首先,可能会存在二选一的情况,然后会给出一些矛盾。据这些矛盾加边,再用SAT判定。这一道题好像不能直接用printf("%0.3lf"),因为这个是四舍五入的,这道题好像不能四舍五入,只好选减去0.0005再按这个格式输出了。 1 #include .....
分类:
其他好文 时间:
2014-07-22 22:49:32
阅读次数:
214
#include<stdio.h> #include<stdlib.h> void f(const char *p) { ?char buf[4]={}; ??? _snprintf(buf, sizeof(buf), "%6s", p); ?printf("%c",buf); ??? printf("%2s",buf); } int main() { ?char s[4]...
分类:
其他好文 时间:
2014-07-22 09:06:03
阅读次数:
240
直接上代码 struct People{
int age;
}
int main(){
struct People * p= malloc(sizeof(struct Perople));
p->age=10;
struct People * p1=p;
p-age=12;
printf("%d\n",p1->age);
free(p);
return 0;
}
} 函...
分类:
编程语言 时间:
2014-07-21 10:22:57
阅读次数:
222
#include
int main()
{
int i,j,a[505]={0};
for(i=1;i<=500;i++)
a[i]=1;
for(i=2;i<=500;i++)
if(a[i])
for(j=i+i;j<=500;j+=i)
a[j]=0;
for(i=2;i<=500;i++)
if(a[i])
printf("%d ",i);
p...
分类:
其他好文 时间:
2014-07-20 09:30:21
阅读次数:
268
1、字符串的表示形式(1)用字符数组存放一个字符串,然后输出该字符串。char string[] = "I am happy";printf("%s",string);(2)用字符指针指向一个字符串。char *string = "I am happy";printf("%s",string);2、...
分类:
编程语言 时间:
2014-07-20 08:16:23
阅读次数:
204
#include
#include
#include
#define N 100
void GetDigits(int *a,char *s);
void multiply(int *a,int *b,int *c);
main()
{
char s1[N],s2[N];
int i,j,a[N],b[N],c[N*2];
printf("\n...
分类:
其他好文 时间:
2014-07-19 23:27:43
阅读次数:
223
在程序的调试过程中,除了那些高大上的调试手段外,printf无疑是我们最熟悉最顺手的调试方法。通过使用printf,我们可以很方便很直观的获取当前程序的运行状态。printf()函数是格式化输出函数,一般用于向标准输出设备按规定格式输出信息。但是在单片机开发中,一般情况下并不存..
分类:
其他好文 时间:
2014-07-19 20:42:00
阅读次数:
307
1、字符数据的输入输出putchar函数:向终端输出一个字符。使用形式:putchar(c);getchar函数:从终端输入一个字符。使用形式:c = getchar();2、格式输入输出2.1 printf函数:向终端输出若干个任意类型的数据。一般格式:printf(格式控制,输出表列)。2.1....
分类:
编程语言 时间:
2014-07-19 14:19:33
阅读次数:
258
c汇编 例子程序如下:#include int main(){int arr[] = {6,7,8,9,10};int * ptr = arr;*(ptr++) += 123;printf("%d, %d\n",*ptr,*(++ptr));return 0;}一开始,指针ptr指向第一个元素6,....
分类:
其他好文 时间:
2014-07-19 14:16:26
阅读次数:
278
一、静态库的创建和使用
1. 静态库创建
(1)首先创建工程test,测试代码如下:
1) test.h
void test_print();
2) test.cpp
#include "test.h"
#include
void test_print()
{
printf("test_print in static lib."...