T1

思路

换算成相同的单位直接相加减

代码

#include <iostream> #include <stdio.h> #include <string.h> #include <algorithm> #include <math.h> using namespace std ; int a , b ; int con = 19 ; int main () { freopen("pencil.in","r",stdin) ; freopen("pencil.out","w",stdout) ; cin >> a >> b ; int ans = a*10+b ; cout << floor(ans / con) <<endl ; return 0 ; } 

T2

思路

打表找规律,容易发现答案就是\(2^{n-1}\)
至于\(2^{n-1}\)的二进制emmmm反正我不会(手动滑稽)

code

#include <iostream> #include <stdio.h> #include <string.h> #include <algorithm> using namespace std ; int T , n ; int main () { freopen("water.in","r",stdin) ; freopen("water.out","w",stdout) ; scanf("%d",&T) ; while(T --) { scanf("%d",&n) ; printf("1") ; for(int i = 1 ; i < n ; i ++) { printf("0") ; } puts("") ; } return 0 ; }

T3

思路

只要别想多就是到比较不错的好模拟

code

#include <iostream> #include <stdio.h> #include <string.h> #include <algorithm> using namespace std ; int n , A , ans ; int main () { freopen("Weita.in","r",stdin) ; freopen("Weita.out","w",stdout) ; scanf("%d",&n) ; if(n<=120) ans = n / 6 ; else if(n > 1200) { ans = 220 + (n-1200)/3 - 3 ; }else { ans = 20 + int(double(n-120)/5.4) - 1; } cout << ans << endl ; return 0 ; }

T4

思路

算出来一天少多少,然后与30比较

代码

#include <iostream> #include <stdio.h> #include <string.h> #include <algorithm> using namespace std ; char s ; double n ; int m ; int main () { freopen("fat.in","r",stdin) ; freopen("fat.out","w",stdout) ; cin >> s ; cin >> n >> m ; n = n * 2 ; int rest = s - 'A' + 2 ; rest -- ; if(m*rest >= 30) { double ans = (n - m*rest)/2.0 ; cout << ans <<endl ; puts("FLAG") ; }else { puts("-233333") ; } return 0 ; }

T5

思路

找出得到工资和因变丑而需要多添的钱之差的最大值然后,,,,

#include <iostream> #include <stdio.h> #include <string.h> #include <algorithm> using namespace std ; int f , n , k , rest , tot = 0 ,maxx ; int abs(int x) { return x > 0 ? x : -x ; } struct dy{ int x , y ; }a[10000] ; int main () { freopen("facelift.in","r",stdin) ; freopen("facelift.out","w",stdout) ; scanf("%d%d%d",&f,&n,&k) ; rest = abs(f)*k ; for(int i = 1 ; i <= n ; i ++) { scanf("%d%d",&a[i].x,&a[i].y) ; maxx = max(a[i].x-a[i].y*k,maxx) ; } if(maxx){ if(rest % maxx == 0) { cout << rest / maxx << endl ; }else { cout << rest / maxx + 1 <<endl ; } } else { puts("-666666") ; } return 0 ; }

T6

思路

爆搜

#include <iostream> #include <stdio.h> #include <string.h> #include <algorithm> using namespace std ; int a[12][12] ; char s[12][12] ; int vis[12][12] , h[12][12] , l[12][12] , small[10] , xie[12][12] ; void dfs(int x,int y) { if(a[x][y]) { if(x == 9 && y == 9) { for(int i = 1 ; i <= 9 ; i ++) { for(int j = 1 ; j <= 9 ; j ++) { cout << a[i][j] << " " ; }puts("") ; } return ; } if(y == 9) dfs(x+1,1) ; else dfs(x,y+1) ; }else { for(int i = 1 ; i <= 9 ; i ++) { if(!h[x][i] && !l[y][i] && !xie[(x-1)/3*3+(y-1)/3+1][i]) { a[x][y] = i ; h[x][i] = 1 ; l[y][i] = 1 ; xie[(x-1)/3*3+(y-1)/3+1][i] = 1 ; if(x == 9 && y == 9) { for(int i = 1 ; i <= 9 ; i ++) { for(int j = 1 ; j <= 9 ; j ++ ) { cout << a[i][j] << " " ; }puts("") ; } return ; } if(y == 9) dfs(x+1,1) ; else dfs(x,y+1) ; a[x][y] = 0 ; h[x][i] = 0 ; l[y][i] = 0 ; xie[(x-1)/3*3+(y-1)/3+1][i]=0; } } } } int main () { freopen("table.in","r",stdin) ; freopen("table.out","w",stdout) ; for(int i = 1 ; i <= 9 ; i ++) { for(int j = 1 ; j <= 9 ; j ++) { cin >> s[i][j] ; } } for(int i = 1 ; i <= 9 ; i ++) { for(int j = 1 ; j <= 9 ; j ++ ) { a[i][j] = s[i][j] - '0'; } } for(int i = 1 ; i <= 9 ; i ++) { for(int j = 1 ; j <= 9 ; j ++) { if(a[i][j] > 0) { h[i][a[i][j]] = 1 ; l[j][a[i][j]] = 1 ; xie[(i-1)/3*3+(j-1)/3+1][a[i][j]] = 1 ; } } } dfs(1,1) ; return 0 ; }

该下去打球了8QAQ