- 博客(22)
- 收藏
- 关注
原创 房间安排
不知道为什么一是WA。#include #include const int MAX = 10000 + 10;using namespace std;typedef struct{ int a; int b; int c;}node;int compare(const void* node0, const void* node1){ return ((node*)no
2014-11-04 21:18:35
235
原创 盗梦空间
#include #include using namespace std;int main(){ int t; cin>>t; while(t--) { int m, s = 0, mult = 1; cin>>m; while(m--) { char ch[10]; cin>>ch; if(!strcmp(ch, "IN")) mu
2014-11-04 19:15:16
434
原创 字符串替换
#include #include const int MAX = 1000+10;using namespace std;int main(){ char ch[MAX]; while(cin.getline(ch, MAX)) { int n = strlen(ch); for(int i = 0; i <= n-1-2; i++) { if(!strnc
2014-11-03 23:09:15
300
原创 两点距离
#include #include using namespace std;int main(){ int n; cin>>n; while(n--) { double x0, y0, x1, y1; cin>>x0>>y0>>x1>>y1; cout.precision(2); cout<<fixed<<sqrt(pow(abs(x1-x0),2)+pow(a
2014-11-03 21:21:57
276
原创 1的个数
#include using namespace std;int main(){ int n; cin>>n; while(n--) { int k; cin>>k; int i = 0; while(k) { k=k&(k-1); i++; } cout<<i<<endl; } return 0;}
2014-11-03 21:16:00
263
原创 成绩转换
#include using namespace std;int main(){ int n; cin>>n; while(n--) { int k; cin>>k; if(k>=90) cout<<"A"<<endl; else if(k>=80) cout<<"B"<<endl; else if(k>=70) cout<<"C"<<end
2014-11-03 21:12:10
260
原创 兄弟郊游问题
#include using namespace std;int main(){ int n; cin>>n; while(n--) { double m, x, y, z; cin>>m>>x>>y>>z; cout.precision(2); cout<<fixed<<m*x/(y-x)*z<<endl; } return 0;}
2014-11-03 21:07:10
245
原创 n-1位数
#include using namespace std; int main(){ int n; cin>>n; while(n--) { int k, m; cin>>k; m = k; int i = 1; while(k/10) { k/=10; i*=10; } if(i==1) cout<<0<<endl; else
2014-11-03 21:00:19
250
原创 开灯问题
#include #include using namespace std;int A[1010];int main(){ int m, n; memset(A, 0, 1010*sizeof(int)); cin>>m>>n; for(int i = 1; i <= n; i++) { for(int j = 1; j <= m; j++) { if(j%i
2014-11-03 20:44:31
301
原创 日期计算
#include using namespace std;const int DAYS[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};bool isLeapyear(int year){ if(year%100) if(year%4==0)return true; else return false; else
2014-11-03 20:31:43
238
原创 小学生算术
#include using namespace std;int main(){ int m, n; while(cin>>m>>n, m&&n) { int i = 0; int a0, a1, b0, b1, c0, c1; a0 = m%10; b0 = m/10%10; c0 = m/100%10; a1 = n%10; b1 = n/10%10
2014-11-03 19:09:48
313
原创 6174问题
#include using namespace std;void getK(int k, int& times){ int a, b, c, d; a = k%10; b = k/10%10; c = k/100%10; d = k/1000%10; if(a<b) { int t = a; a = b; b = t; } if(c<d) { int
2014-11-02 10:55:09
365
原创 阶乘因式分解(一)
#include using namespace std;int getK(int m, int n){ int i = 0; while(true) { if(m%n==0) { i++; m/=n; } else break; } return i;}int main(){ int T, m, n, i; cin>>T; fo
2014-11-02 00:10:49
249
原创 三个数从小到大排序
#include using namespace std;int main(){ int a, b, c; cin>>a>>b>>c; if(a>b) { a=a^b; b=a^b; a=a^b; } if(b>c) { b=b^c; c=b^c; b=b^c; } if(a>b) { a=a^b; b=a^b; a=a^b; }
2014-11-01 23:39:25
415
原创 公倍数和公约数
#include using namespace std;int GCD(int i, int j){ if(i<j) { int t = i; i = j; j = t; } if(j==0) return i; else return GCD(j, i%j);}int LCM(int i, int j){ return i*j/GCD(i, j
2014-11-01 23:32:28
278
原创 水仙花数
#include using namespace std;bool isDaffodils(int n){ int a, b, c; a = n%10; b = n/10%10; c = n/100%10; if(n==a*a*a+b*b*b+c*c*c) return true; else return false;}int main(){ int n; w
2014-11-01 23:21:29
278
原创 韩信点兵
#include using namespace std;int main(){ int a, b, c; cin>>a>>b>>c; for(int i = 10; i < 100; i++) { if(i%3==a&&i%5==b&&i%7==c) { cout<<i<<endl; break; } } //system("PAUSE"); re
2014-11-01 23:04:48
360
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅