摘要: 1 #include<iostream> 2 3 using namespace std; 4 5 int main() { 6 int n = 0; 7 int num[10] = { 0 }; 8 int sum = 0; 9 cin >> n; 10 for (int i = 0; i < n 阅读全文
posted @ 2020-08-24 00:36 上帝的绵羊 阅读(229) 评论(0) 推荐(0) 编辑
摘要: 好难啊,困了 1 #include<iostream> 2 #include<vector> 3 #include<algorithm> 4 5 using namespace std; 6 7 int main() 8 { 9 int n, k, m, h; 10 cin >> n >> k; 1 阅读全文
posted @ 2020-08-23 02:51 上帝的绵羊 阅读(223) 评论(0) 推荐(0) 编辑
摘要: 主要还是两个函数的使用:sscanf 和 sprintf sscanf int sscanf(const char * s,const char * format,...); sprintf int sprintf(char * str,const char * format,...); 1 #in 阅读全文
posted @ 2020-08-21 00:48 上帝的绵羊 阅读(181) 评论(0) 推荐(0) 编辑
摘要: 以后做题会尽量少用python了,毕竟考场上用python挺吃亏的 但会拿python从另一个角度考虑题的解法 阅读全文
posted @ 2020-08-20 21:59 上帝的绵羊 阅读(268) 评论(0) 推荐(0) 编辑
摘要: 没什么多说的,看清题目要求(多读读判断方法)就能AC 1 #include<iostream> 2 3 using namespace std; 4 5 int main() { 6 int n = 0, d = 0; 7 /*可能空置和空置*/ 8 int empty = 0, mayempty 阅读全文
posted @ 2020-08-19 21:19 上帝的绵羊 阅读(114) 评论(0) 推荐(0) 编辑
摘要: 使用格式化字符串"%[^...]",这种字符串的作用类似于"%s",前者使scanf读到^后面的字符,但是后者会读取字符串到空白字符(空格、换行、制表符等等),相当于用户可以自定义scanf的行为(只能用char字符串去存储输入得到的格式化字符串) 利用vector<vector<string>>来 阅读全文
posted @ 2020-08-19 04:16 上帝的绵羊 阅读(160) 评论(0) 推荐(0) 编辑
摘要: 突然想用python了 用C++的话,注意计算出a,b后像 -0.005 < a < 0.005, -0.005 < b < 0.005 这种情况会保留两位小数时,会直接输出0.00,应该输出0(测试点2,3),所以需要判定a,b的范围 python直接利用round提前进行小数点的保留即可 1 i 阅读全文
posted @ 2020-08-18 00:46 上帝的绵羊 阅读(238) 评论(0) 推荐(0) 编辑
摘要: 这题真的是想了老半天,也不太会,看了看别人的,学习学习 1 #include<iostream> 2 #include<algorithm> 3 #include<vector> 4 #include<cmath> 5 using namespace std; 6 /*用于排序的二维数组*/ 7 i 阅读全文
posted @ 2020-08-15 16:16 上帝的绵羊 阅读(155) 评论(0) 推荐(0) 编辑
摘要: 还是想了第一版的做法,暴力算法,超时了 1 #include<iostream> 2 #include<vector> 3 4 using namespace std; 5 6 int main() { 7 double n = 0; 8 double sum = 0.0; 9 cin >> n; 阅读全文
posted @ 2020-08-11 19:20 上帝的绵羊 阅读(231) 评论(0) 推荐(0) 编辑
摘要: 最一开始想直接用整型,%10不断取余的处理方式,但是测试点4,5无法通过,原因在代码后面 1 #include<iostream> 2 #include<string> 3 #include<algorithm> 4 5 using namespace std; 6 7 int main() { 8 阅读全文
posted @ 2020-08-10 23:29 上帝的绵羊 阅读(405) 评论(0) 推荐(1) 编辑