浙江工商大学OJ题
涛涛和三猫
少时了了
展开
-
101_本土化
#include<iostream>#include<string>using namespace std;int main(){ string str1; while(cin>>str1){ string str2,str3; int t2=0,t3=0; for(int i=0;i<str1.length();i++){ if(str1[i]!=','){ ...原创 2020-05-14 11:52:29 · 174 阅读 · 0 评论 -
36_JLH统计法统计飞龙
#include<iostream>#include<string>#include<string.h>#include<math.h>using namespace std;int ele[26]={0};int main(){ int T; string dragons; cin>>T; while(T--){ cin>>dragons; fo...原创 2020-05-13 14:43:24 · 256 阅读 · 0 评论 -
Daota(未完成)
#include<iostream>#include<string>#include<math.h>using namespace std;struct Opponent//敌人类型{ int x; int y; int hp; int distance;}opponent[5];int main(){ int X, Y;//我的位置 int x, y, hp;//敌人 double L, R;/...原创 2020-05-13 14:14:41 · 174 阅读 · 0 评论 -
31_找出第k个被3,5,7除的时候,余数为2,3,2的数
Description找出第k个被3,5,7除的时候,余数为2,3,2的数Input:有多组测试样例,输入直到文件末尾。每组样例输入一个数k(k1)。Output:输出表示第k个符合条件的数。Sample Input:12Sample Output:23128#include<iostream>using namespace std;int main() { long long k; while (cin >>.原创 2020-05-11 23:24:13 · 724 阅读 · 0 评论 -
27_又要数小绵羊
#include<stdio.h>#include<iostream>#include<string>using namespace std; bool isprime(int n) { if (n < 2) { return false; } if (n == 2 || n == 3) { return true; } for (int i = 2; i * i <= n; i++) { if (n % i == ...原创 2020-05-11 18:17:15 · 675 阅读 · 0 评论 -
20_挑战德雷格
#include<iostream>#include<cmath>using namespace std;int main() { int n; while (cin >> n) { if (n % 3 == 0)cout << "No" << endl; else cout << "Yes" << endl; }}这个题目为什么是三的倍数就输了呢?有大佬下面解释一下吗...原创 2020-05-11 16:28:20 · 254 阅读 · 0 评论 -
19_最大字串和
#include<iostream>#include<string>#include<string.h>#include<stdio.h>#include<algorithm>using namespace std;int main(){ int n, maxx, m; int arr[999];//存放输入的数组 while (cin >> n) {//测试输入n if (n == 0) return ...原创 2020-05-11 15:53:01 · 142 阅读 · 0 评论 -
99_颤抖吧!(string切片)(string int 相互转换)
①备注:必须记一下耗费我一中午的题,②题目特点:输入几个数字,个数不确定。输入不同需求不同③设计知识:<sstream>(get到了新知识) ,string 与 int 转换 string依据空格切片④代码:#include <iostream>#include <string>#include <sstrea...原创 2020-04-30 15:02:08 · 456 阅读 · 0 评论 -
93_亲密数(时间复杂度)
这个题以后提醒自己,时间超限问题 的优化思路,不要去做过多的遍历Time Limit Exceeded第一次因为时间超时提交没有A第一次的代码:#include<iostream>#include<stdio.h>#include<cmath>using namespace std;int q(int x){ ...原创 2020-04-29 14:57:32 · 217 阅读 · 0 评论 -
91_质因数分解问题(唯一分解定理)
每个合数都可以写成几个质数相乘的形式,且每个质数又是他的因数。!!并且,每个合数能且只能够被分解为唯一一组质因数乘积。#include<iostream>#include<stdio.h>using namespace std; int main(){ int n; int a[1000],t=0; cin>>n;//输...原创 2020-04-29 14:45:50 · 1382 阅读 · 0 评论 -
61_绳子和狐狸的故事
Description:当年狐狸智斗绳子,换来了生命的重生,心里美滋滋的,尾巴翘的更高了。猎人可谓是机智、勇敢,而这件事情让他颜面扫尽,因此猎人决定夺回面子,再次和狡猾的狐狸一分高下。 大家都知道当年猎人输就输在绳子上面,因此猎人所要做的第一件事情就是从绳子上做文章。 假设一根绳子所能承受的最大的重量为k,若一个物体的重量超过了k,明显这根绳子就会断掉。若将n根绳子扭在一起来吊起一个重量为w的...原创 2020-04-28 10:37:14 · 413 阅读 · 0 评论 -
65_数字金字塔(动态规划)
这个题是动态规划 入门题,我终于入门了,,,这个题的解题思路:常规建二位数组73 88 1 02 7 4 44 5 2 6 573 88 1 07 12 10 10 //这里的数字是原来数字+ 下面两个数字的大数4...原创 2020-04-28 00:14:40 · 586 阅读 · 0 评论 -
约瑟夫环问题
#include <stdio.h>#include<iostream>using namespace std;int main(){ int n; cin>>n; int a[n],i=0,call=0, out=0; //用下标代表123456... 用数组里的数代表是否删除 0:还在 1:推出 for(int i=0 ;i...原创 2020-03-07 13:21:36 · 146 阅读 · 0 评论 -
73_猴子吃桃子
#include<iostream>#include<stdio.h>using namespace std;int main(){ int N; cin>>N; int peach=1; while(--N){ peach = peach+1; peach = peach*2; ...原创 2020-02-17 13:24:18 · 98 阅读 · 0 评论 -
72_小球落地
#include<iostream>#include<stdio.h>using namespace std;int main(){ double M; int N; cin>>M>>N; double sum=M; while(--N){ sum = sum + M/2;...原创 2020-02-17 13:15:51 · 135 阅读 · 0 评论 -
71_分式相加
#include<iostream>#include<stdio.h>using namespace std;int main(){ int N; cin>>N; double fz=2,fm=1; double d; double sum=0; while(N--){ sum ...原创 2020-02-17 12:58:49 · 218 阅读 · 0 评论 -
53_打印菱形
#include<iostream>using namespace std;int main(){ int n; cin>>n; for(int i=1;i<=n;i++){ for(int j=1;j<=n-i;j++){ cout<<" "; } ...原创 2020-02-16 13:38:22 · 112 阅读 · 0 评论 -
9_数绵羊
#include<iostream>#include<stdio.h>#include<string>using namespace std;typedef struct Goat{//统计每次捉羊????的结构体 int Pleasant_goat=0; int Pretty_goat=0; int Athletic_...原创 2020-02-05 21:53:53 · 240 阅读 · 0 评论 -
59_求最大公约数 与最小公倍数
#include<stdio.h>int f(int x,int y){ int t; while(y!=0) { t=x%y; x=y; y=t; } return x;}int main(){ int x,y,t=0,d=0; scanf("%d %d",&x,&y); t = f(x,y); d=x*y/t; pr...原创 2020-01-23 14:27:00 · 382 阅读 · 0 评论 -
58_单词统计
#include<iostream>#include<stdio.h>using namespace std;int main(){ char str[100]; gets(str); int numbers = 0; int flag =0;//用来标记 如果是第一个字母 for(int i=0;str[i]!='...原创 2020-01-22 18:00:15 · 108 阅读 · 0 评论 -
56_时间间隔
#include<stdio.h>#include<iostream>using namespace std;int main(){ int s1,f1,m1; int s2,f2,m2; int s,f,m; scanf("%d:%d:%d",&s1,&f1,&m1); scanf("...原创 2020-01-21 18:08:19 · 98 阅读 · 0 评论 -
55_删除指定字符串
#include<stdio.h>#include<iostream>using namespace std;int main(){ char str[100]; char c; gets(str); cin>>c; for(int i=0;str[i]!='\0';i++){ if(str[...原创 2020-01-20 14:27:58 · 204 阅读 · 0 评论 -
54_分割整数
#include<stdio.h>#include<iostream>using namespace std;int main(){ long long l; int arr[100]; int t = 0; cin>>l; while(l!=0){ arr[t] = l%10; ...原创 2020-01-20 14:22:15 · 99 阅读 · 0 评论 -
6_jlh(九零后) 的童年
这个 我第二天才做出来,,(菜鸡ben鸡) 就是想不明白陷阱布置完之后怎么跳的 后来看到“ 弹珠每次只能挑一个陷阱,不能多也不能多少 ” 终于想明白是: 因为要跳过所有陷阱,所以要跳最大陷阱 所以用max为跳的距离 每个!陷阱左边起始点 + max 不能超出 第二个陷阱左边起始点 。这样就可以,有猫饼 -。...原创 2020-01-09 15:38:39 · 401 阅读 · 4 评论 -
42_一元二次方程
解一元二次方程ax2+bx+c=0的解。题目保证有两个不同的解。Input:a,b,c的值。Output:两个根X1和X2,其中X1>=X2。。 结果保留两位小数。Sample Input:1 5 -2Sample Output:0.37 -5.37************************************************...原创 2020-01-07 18:57:56 · 200 阅读 · 0 评论 -
43_保留字母
Description:编一个程序,输入一个字符串,将组成字符串的所有非英文字母的字符删除后输出。Input:一个字符串,长度不超过90个字符。Output:删掉非英文字母后的字符串。Sample Input:abc123+xyz.5Sample Output:abcxyz#include<stdio.h>...原创 2020-01-07 19:10:47 · 248 阅读 · 0 评论 -
45_矩阵转置
#include<stdio.h>#include<iostream>#include<string.h>using namespace std;int main(){ int N; cin>>N; int matrix[N][N]; if(N>20) return 0; for(int ...原创 2020-01-07 19:21:13 · 204 阅读 · 0 评论 -
48_序列求和
#include<stdio.h>#include<iostream>#include<string.h>using namespace std;int main(){ int n; cin>>n; double fz=2, fm=1; double fs, temp; double sum...原创 2020-01-08 15:13:28 · 92 阅读 · 0 评论 -
49_最值
#include<stdio.h>#include<iostream>#include<string.h>using namespace std;int main(){ int n; cin>>n; int temp; int i_min, i_max; int a[n]; for(...原创 2020-01-08 16:08:53 · 115 阅读 · 0 评论 -
50_保留整数
这个题需要注意的是: 自加一个 *; str2 最后要加一个‘\0’;#include<stdio.h>#include<iostream>#include<string.h>using namespace std;int main(){ char str1[80]; char str2[8...原创 2020-01-09 15:45:33 · 398 阅读 · 1 评论 -
51_下三角形之和
#include<stdio.h>#include<iostream>#include<string.h>using namespace std;int main(){ int n; cin>>n; int sum = 0; int a[n][n]; for(int i=0;i<...原创 2020-01-09 16:19:55 · 90 阅读 · 0 评论 -
52_字符逆序
#include<stdio.h>#include<iostream>#include<string.h>using namespace std;int main(){ char c[100]; gets(c); for(int i=strlen(c)-1;i>=0;i--){ cout<...原创 2020-01-09 16:29:21 · 100 阅读 · 1 评论