06 2020 档案
摘要:很奇怪啊,测试点7一直无法通过 测试点8若无法通过,原因可能是没有考虑A2可能为0情况(进行过A2的计算,但和初始化0重复),利用标志位进行解决 1 #include<iostream> 2 #include<vector> 3 #include<cmath> 4 #include<iomanip>
阅读全文
摘要:今日的简单一题 1 #include<iostream> 2 3 using namespace std; 4 5 int main() { 6 long a = 0, b = 0, c = 0; 7 int n = 0; 8 string judge[10]; 9 cin >> n; 10 for
阅读全文
摘要:今天的题虽然简单,但是有个细节一定要注意,先放代码: 1 #include<iostream> 2 #include<vector> 3 using namespace std; 4 5 int main() { 6 int n = 0; 7 vector<int> num; //vector动态处
阅读全文
摘要:Python 首先想到的是用py去做,字符串获取后用split直接分割,分割后输出就行,没有难度 1 s = input() 2 word = s.split(" ") 3 word.reverse() 4 print(" ".join(word)) 缺点就是速度慢,占内存,做OJ题都这样吧 C++
阅读全文
摘要:用C语言写的,逐个移动每一位的位置实现右移 C语言 1 #include<stdio.h> 2 3 void swap(int* n, int count,int num) { 4 int tmp = 0; 5 int i = 0; 6 int j = count - 2; 7 for (i = 0
阅读全文
摘要:C++(C改一改输入输出即可) 1 #include<iostream> 2 #include <cmath> 3 using namespace std; 4 5 bool isprime(int i) { 6 for (int j = 2; j <= sqrt(i); ++j) { 7 if (
阅读全文
摘要:C/C++ 1 #include<iostream> 2 using namespace std; 3 4 int main() { 5 int n = 0; 6 cin >> n; 7 int b = n / 100; 8 int s = n / 10 % 10; 9 int g = n % 10
阅读全文
摘要:C++ 1 #include <iostream> 2 #include <vector> 3 #include <algorithm> 4 using namespace std; 5 bool cmp(int a, int b) { 6 return a > b; 7 } 8 int main(
阅读全文
摘要:JAVA 写的很冗余,也没考虑类之间的关系,还能更简洁,更高效,仅做参考 有时间考虑做一个学生数据库 1 import java.util.Arrays; 2 import java.util.HashMap; 3 import java.util.Scanner; 4 5 public class
阅读全文
摘要:Python 1 num = eval(input()) 2 an = [] 3 for i in range(0,num): 4 str = input() 5 P = str.count('P') 6 T = str.count('T') 7 A = str.count('A') 8 sum =
阅读全文
摘要:C/C++ 1 #include<stdio.h> 2 3 int main(){ 4 char str[10][5] = {"ling","yi","er","san","si","wu","liu","qi","ba","jiu"}; 5 char num[100]; 6 int sum = 0
阅读全文
摘要:C 1 #include<stdio.h> 2 3 int main(){ 4 int n = 0; 5 int num = 0; 6 //printf("请输入一个不超过1000的正整数:"); 7 scanf("%d", &num); 8 while(num != 1){ 9 if(num%2
阅读全文

浙公网安备 33010602011771号