zoukankan      html  css  js  c++  java
  • 团体程序设计天梯赛 L1-036~L1-040

    L1-036

    思路:

    相乘输出即可

    代码:

    #include<bits/stdc++.h>
    
    using namespace std;
    
    int main() {
    	int a, b;
    	cin >> a >> b;
    	cout << a * b;
    	return 0;
    }
    

    L1-037

    思路:

    按格式输出即可

    代码:

    #include<bits/stdc++.h>
    
    using namespace std;
    
    int main() {
    	int a, b;
    	cin >> a >> b;
    	printf("%d/", a);
    	if(b < 0) printf("(%d)=", b);
    	else printf("%d=", b);
    	if(b){	printf("%.2f", a * 1.0 / b); }
    	else puts("Error");
    	return 0;
    }
    

    L1-038

    思路:

    输出即可

    代码:

    #include<bits/stdc++.h>
    
    using namespace std;
    
    int main() {
    	puts("Hello World");
    	puts("Hello New World");
    	return 0;
    }
    

    L1-039

    思路:

    稍微找一下规律,输出即可

    代码:

    #include<bits/stdc++.h>
    
    using namespace std;
    
    int main() {
    	int n; cin >> n; getchar();
    	string s; getline(cin, s);
    	int len = s.length(), pos = len - 1;
    	while(pos % n) --pos;
    	for(int i = 0; i < n; i++){
    		for(int st = pos++; st >= 0; st -= n)
    			putchar(st < len ? s[st] : ' ');
    		putchar('
    ');
    	}
    	return 0;
    }
    

    L1-040

    思路:

    判断相乘或者相除
    找一个161的女朋友有没

    代码:

    #include<bits/stdc++.h>
    
    using namespace std;
    
    int main() {
    	int kase;
    	cin >> kase;
    	while(kase--){
    		char c;
    		double h;
    		cin >> c >> h;
    		if(c == 'M') printf("%.2f
    ", h / 1.09);
    		else printf("%.2f
    ", h * 1.09);
    	}
    	return 0;
    }
    
  • 相关阅读:
    P4995 跳跳!
    P4306 [JSOI2010]连通数
    P1339 [USACO09OCT]热浪Heat Wave
    P2002 消息扩散
    P3388 【模板】割点(割顶)
    P1656 炸铁路
    P2863 [USACO06JAN]牛的舞会The Cow Prom
    P1516 青蛙的约会
    3.从尾到头打印链表
    2.替换空格
  • 原文地址:https://www.cnblogs.com/yuhan-blog/p/12308677.html
Copyright © 2011-2022 走看看