Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 4 additions & 0 deletions OpenJudge/ProblemSet/1510/input
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
6 5
8 3
1 5
2 3
4 changes: 4 additions & 0 deletions OpenJudge/ProblemSet/1510/output
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
1
7
1
2
37 changes: 37 additions & 0 deletions OpenJudge/ProblemSet/1510/problem.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# 猴子选大王
Time Limit: 2 Sec  Memory Limit: 16 MB


## Description
有一群进化程度很高的猴子,它们不再通过群殴产生猴王,而是采用一种非常文明的方法选出新的猴王。
假设猴群里有m只猴子,它们在篝火旁围坐成一个圈:某只猴子是1号,沿顺时针方向是2号、3号……m号,然后回到1号。由上一代猴王说出一个数字n,从1号猴子开始报数,报到n的猴子出局;再从刚出局猴子的下一个位置开始报数,报到n的猴子出局……如此重复,直至剩下一只猴子,它就成为新的猴王。
例如,当m=6、n=5时,依次出局的猴子序号是5、4、6、2、3,最后剩下1号是新猴王。
你来编写一个程序,模拟这个过程,算出第几号猴子会成为新的猴王。


## Input
输入最多不超过100行,至EOF结束。每行一组数据,每组数据包含两个整数m和n(0<m,n<1000)。


## Output
输出与输入对应,每行输出一个整数k(1<=k<=m),表示第k号猴子成为新的猴王。


## Sample Input
```
6 5
8 3
1 5
2 3

```
## Sample Output
```
1
7
1
2

```

## HINT
1 change: 1 addition & 0 deletions OpenJudge/ProblemSet/2683/input
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1 1 3
1 change: 1 addition & 0 deletions OpenJudge/ProblemSet/2683/output
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.250
26 changes: 26 additions & 0 deletions OpenJudge/ProblemSet/2683/problem.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# 简单计算二
Time Limit: 1 Sec  Memory Limit: 2 MB


## Description
         给定三个整数a、b、c,计算表达式a / (b + c)的值;其中“/”是浮点运算。


## Input
         输入为一行,包括三个数值较小整数a、b、c,且b + c不为零。


## Output
         输出一行,即表达式的计算结果,要求精确到小数点后3位。


## Sample Input
```
1 1 3
```
## Sample Output
```
0.250
```

## HINT
1 change: 1 addition & 0 deletions OpenJudge/ProblemSet/2684/input
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1 2 3 4 5
1 change: 1 addition & 0 deletions OpenJudge/ProblemSet/2684/output
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9 6
26 changes: 26 additions & 0 deletions OpenJudge/ProblemSet/2684/problem.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# 奇偶求和
Time Limit: 1 Sec  Memory Limit: 2 MB


## Description
         输入若干整数,求其中所有奇数之和与所有偶数之和。


## Input
         输入只包含若干整数,至EOF结束。所有运算不会超过int存储范围。


## Output
         输出两个整数,分别是输入的所有奇数之和与所有偶数之和。


## Sample Input
```
1 2 3 4 5
```
## Sample Output
```
9 6
```

## HINT
1 change: 1 addition & 0 deletions OpenJudge/ProblemSet/2685/input
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3
5 changes: 5 additions & 0 deletions OpenJudge/ProblemSet/2685/output
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
+
+
+++++
+
+
31 changes: 31 additions & 0 deletions OpenJudge/ProblemSet/2685/problem.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# 打印十字型
Time Limit: 1 Sec  Memory Limit: 2 MB


## Description
         从键盘输入一个整数n(1≤n≤10),打印出指定的十字图形。


## Input
         输入正整数n(1~10)。


## Output
         n阶十字型。


## Sample Input
```
3
```
## Sample Output
```
+
+
+++++
+
+

```

## HINT
1 change: 1 addition & 0 deletions OpenJudge/ProblemSet/2686/input
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1 1 3
1 change: 1 addition & 0 deletions OpenJudge/ProblemSet/2686/output
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.250
56 changes: 56 additions & 0 deletions OpenJudge/ProblemSet/2686/problem.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# 简单计算二(Append Code)
Time Limit: 1 Sec  Memory Limit: 2 MB


## Description
         给定三个整数a、b、c,计算表达式a / (b + c)的值;其中“/”是浮点运算。
-----------------------------------------------------------------------------
         编写函数 f():
                   原型:void f(int a, int b, int c);
                   功能:根据题意完成计算和输出。
         函数的调用格式见“Append Code”。


## Input
         输入为一行,包括三个数值较小整数a、b、c,且b + c不为零。


## Output
         输出一行,即表达式的计算结果,要求精确到小数点后3位。


## Sample Input
```
1 1 3
```
## Sample Output
```
0.250
```

## HINT


## Append Code
### append.c
```c
int main()
{
int a, b, c;
scanf("%d%d%d", &a, &b, &c);
f(a, b, c);
return 0;
}

```
### append.cc
```cpp
int main()
{
int a, b, c;
cin >> a >> b >> c;
f(a, b, c);
return 0;
}

```
2 changes: 2 additions & 0 deletions OpenJudge/ProblemSet/2687/input
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
5
1 2 3 4 5
1 change: 1 addition & 0 deletions OpenJudge/ProblemSet/2687/output
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1 5
59 changes: 59 additions & 0 deletions OpenJudge/ProblemSet/2687/problem.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# 求数组中最大最小值(Append Code)
Time Limit: 1 Sec  Memory Limit: 2 MB


## Description
         给出若干整数,求其中的最大值和最小值。


## Input
         首先输入一个整数n(n<100),然后输入n个整数。


## Output
         输出n个整数中的最小值和最大值。


## Sample Input
```
5
1 2 3 4 5

```
## Sample Output
```
1 5
```

## HINT


## Append Code
### append.c
```c
int main()
{
int max, min, ar[100], i, n;
scanf("%d", &n);
for(i = 0; i < n; i++)
scanf("%d", &ar[i]);
max_min(&max, &min, ar, n);
printf("%d %d\n", min, max);
return 0;
}

```
### append.cc
```cpp
int main()
{
int max, min, ar[100], i, n;
scanf("%d", &n);
for(i = 0; i < n; i++)
scanf("%d", &ar[i]);
max_min(&max, &min, ar, n);
printf("%d %d\n", min, max);
return 0;
}

```
2 changes: 2 additions & 0 deletions OpenJudge/ProblemSet/2688/input
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
20011101
20220909
2 changes: 2 additions & 0 deletions OpenJudge/ProblemSet/2688/output
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
2001 11 1
2022 9 9
68 changes: 68 additions & 0 deletions OpenJudge/ProblemSet/2688/problem.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# 字符串转日期(Append Code)
Time Limit: 1 Sec  Memory Limit: 2 MB


## Description
         对于用字符串存储的日期,把它的年月日提取出来转换成结构体形式。
-----------------------------------------------------------------------------
         编写函数 to_date ():
                   原型:根据“Append Code”进行设计。
                   功能:把字符串s中年月日信息提取出来,并用结构体变量返回。
         函数的调用格式见“Append Code”,完成结构体类型的定义。


## Input
         输入若干字符串,每个一行。每个字符串为一个合法的日期,其中前4位表示年份,中间两位表示月份,后2位表示日,位数不足会补0。


## Output
         按照年月日的顺序输出,两两用一个空格分开。


## Sample Input
```
20011101
20220909

```
## Sample Output
```
2001 11 1
2022 9 9

```

## HINT


## Append Code
### append.c
```c
int main()
{
char str[10];
struct date dt;
while(gets(str) != NULL)
{
dt = to_date(str);
printf("%d %d %d\n", dt.y, dt.m, dt.d);
}
return 0;
}

```
### append.cc
```cpp
int main()
{
char str[10];
struct date dt;
while(gets(str) != NULL)
{
dt = to_date(str);
printf("%d %d %d\n", dt.y, dt.m, dt.d);
}
return 0;
}

```
1 change: 1 addition & 0 deletions OpenJudge/ProblemSet/2689/input
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
5
1 change: 1 addition & 0 deletions OpenJudge/ProblemSet/2689/output
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
8
30 changes: 30 additions & 0 deletions OpenJudge/ProblemSet/2689/problem.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# 递归求斐波那契数
Time Limit: 1 Sec  Memory Limit: 2 MB


## Description
         斐波那契数列是1、2、3、5、8、13……。其中,每项是前两项之和。
         现在请你用递归方法编程求斐波纳契数列第n项。
         -----------------------------------------------------------------------------
         Invalid Word(禁用单词)错误:在解决这个题目时,某些关键词是不允许被使用的。如果提交的程序中包含了下列的关键词之一,就会产生这个错误。
         被禁用的关键字:for, while, do, break, continue, goto。


## Input
         输入一个整数n。


## Output
         输出斐波那契数列的第n项。


## Sample Input
```
5
```
## Sample Output
```
8
```

## HINT
Loading