Codecodify
Codecodify
全部文章
分类
题解(49)
归档
标签
去牛客网
登录
/
注册
Codecodify的博客
全部文章
(共40篇)
题解 | #魔法数字变换#
可以用三元运算符 #include <stdio.h> int main() { int n = 0, step = 0; scanf("%d", &n); while(n != 1) { n = n % 2 == 0 ? n / 2 :...
C
C++
2023-05-03
0
288
题解 | #幸运数字7#
用等差数列公式可以不走循环操作。如果找出7的倍数,可以减少循环的次数 等差数列: int main() { int num = 0; scanf("%d", &num); printf("%d", (7 + num / 7 * 7) * (num / 7) / 2);...
C++
C
2023-05-03
0
459
题解 | #牛牛学数列#
思路一:所以奇数的和 - 所有偶数的和 #include <stdio.h> int main() { int odd = 0, even = 0, num = 0; scanf("%d", &num); for(int i = 1; i <= n...
C
C++
2023-05-02
0
305
题解 | #最大最小值#
使用冒泡排序 #include <stdio.h> #define MaxSize 3 void sort(int nums[]) { for (int i = 0; i < MaxSize; i++) { for(int j = i + 1; j <...
C
C++
2023-04-23
0
291
题解 | #牛妹数#
#include <stdio.h> int main() { char* str = "no"; int num; scanf("%d", &num); if(num % 2 == 0 && num > 50) { ...
C
C++
2023-04-21
0
304
题解 | #一大一小#
使用异或操作也可以实现两个变量值的交换 #include <stdio.h> #include <math.h> int main() { int x, y; scanf("%d%d", &x, &y); if(y > x) {...
C
C++
2023-04-21
0
201
题解 | #判断奇偶#
使用字符指针 #include <stdio.h> int main() { char* str = "even"; int num; scanf("%d", &num); if(num % 2 != 0) { ...
C
C++
2023-04-21
0
267
题解 | #温度转换#
#include <stdio.h> int main() { float f; scanf("%f", &f); printf("%.3f\n", 5.0 / 9 * (f - 32)); return 0; }
C
C++
2023-04-15
0
233
题解 | #平方根#
#include <stdio.h> #include <math.h> int main() { int num; scanf("%d", &num); printf("%d\n", (int) floor(sqrt(num)))...
C
C++
2023-04-15
0
226
题解 | #求平均值#
#include <stdio.h> #define Size 3 double average(int nums[], int size) { double total = 0; for(int i = 0; i < size; i++) { t...
C
C++
2023-04-15
0
274
首页
上一页
1
2
3
4
下一页
末页