codeforces 677A-C語言解題報告

677A題目網址

題目解析

1.輸入n個數字,如果輸入的數字比h大,就加2,如果小于等于h,就加1

舉例:
輸入:
3 7
4 5 14
輸出:
4

代碼

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
int main()
{ int n=0,h=0,count=0;int num[1000]={0};scanf("%d %d",&n,&h);for(int i=0;i<n;i++){scanf("%d",&num[i]);if(num[i]>h){count+=2;}else{count+=1;}}printf("%d",count);getchar();system("pause");return 0;
}

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/446625.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/446625.shtml
英文地址,請注明出處:http://en.pswp.cn/news/446625.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

c++面向對象高級編程 學習四 靜態、類模板、函數模板

靜態static&#xff1a;靜態數據和靜態函數&#xff0c;在內存中只有一份&#xff0c;不會隨著創建對象的數目的增加而增加 static數據&#xff1a;比如銀行的account類中&#xff0c;賬戶名是普通數據&#xff0c;100個對象會有100個賬戶名&#xff0c;但利率都是相同的&#…

線程的編程

完整代碼 #include <sys/shm.h> #include <iostream> #include <unistd.h> #include <pthread.h>void * child1(void *arg){pthread_t tid pthread_self();printf("1 thread %lu \n",tid);}int main(int argc,char* argv[]) {int result{…

英語口語 week11 Friday

英語文章 I very much like simplicity in life. For me, college is far more than a place to improve my intellectual abilities Every weekend, I usually have a walk along the way to the front gate of Mount Qingcheng, enjoying the intense aromas of flowers on …

c++面向對象高級編程 學習五 組合、委托與繼承

組合 composition 表示has a queue類中有一個deque容器&#xff0c;這種關系叫做 組合 queue中的六個函數都是調用c的函數完成的 template <class T> class queue { ... protected: deque<T> c; // 底層容器 public: // 以下完全利用 c 的操作函數完成 bool empt…

C++四種類型轉換運算符:static_cast、dynamic_cast、const_cast和reinterpret_cast

參考鏈接 C四種類型轉換運算符&#xff1a;static_cast、dynamic_cast、const_cast和reinterpret_cast

英語口語 week12 WednesDay

英語文章 Chengdu, a city with a long history, has always enjoyed the reputation as " The Land of Abundance" . It has been noted as one of the most livable cities in China, partly resulting from its favorable natural conditions and wealthy produc…

c++面向對象高級編程 學習六 虛函數

虛函數&#xff1a;在成員函數前面加上virtual&#xff0c;函數就變成了虛函數 繼承函數&#xff1a;子類可以調用父類的函數&#xff0c;叫做繼承了函數&#xff0c;即函數的調用權 三種函數&#xff1a; non-virtual 函數&#xff1a; 你不希望 derived class 重新定義 (ov…

C++ 數據結構 線性鏈表

#pragma once 減少頭文件組合&#xff0c;降低編譯出錯的概率作用等效于 #ifndef FUNC_H #define FUNC_H代碼主體#endif 線性表的定義 排隊問題 簡單的線性表 (物理 或者邏輯結構)1&#xff0c;數組2&#xff0c;鏈表線性表相關操作&#xff1a;1&#xff0c;線性表初始化2&a…

英語口語 week12 Thursday

英語文章 As the pace of life quickens with technological advancements, people are occupied by all kinds of trivial matters. They seem forever on the go. There’s no difficulty in imagining that the hustle and bustle of everyday life can make us lose focus…

H.264/AVC視頻編解碼技術詳解 第一章 視頻信息與壓縮編碼

H.264/AVC視頻編解碼技術詳解系列筆記 是對 H.264/AVC視頻編解碼技術詳解 課程的學習 文章目錄人與世界的交互視頻信號的表示方法視頻壓縮編碼視頻信息為什么可以被壓縮&#xff1f;視頻壓縮編碼的分類&#xff1a;視頻壓縮編碼的基本技術人與世界的交互 從遠古時代開始&#…

英語口語 week13 Monday

英語文章 Competitions between businesses can be very aggressive in contemporary society. However, the competition for talented personnel is thought to be the key to business competition. Wise employers consider their employees as the company’s core asset…

文件系統的由來

啟蒙篇 文件的由來 磁盤上保存的是一對十六進制的數據&#xff0c;如何切分數據形成不同的文件&#xff0c;也就是如何確定一個文件的起始和終止位置&#xff1f;將相關數據打包在一起形成一個文件&#xff0c;比如從什么位置開始到什么位置結束&#xff0c;是一張圖片、一段…

c++面向對象高級編程 學習七 轉換函數

轉換函數&#xff1a;對象A和對象B之間的互相轉換。 class Fraction { public:Fraction(int num,int den1):m_numerator(num),m_denominator(den){}operator double()const{return (double)(m_numerator/m_denominator);} private:int m_numerator; //分子int m_denominator;/…

英語口語 week13 Wednesday

英語文章 Despite his extraordinary success in writing fairy tales,Hans Christian Andersen preferred to living in a way of simplicity and frugality. He often wore an old hat when he went out. One day, a well-dressed man stopped Andersen on the street, inte…

數據結構 隊列

隊列 代碼 #include <stdio.h> #include <stdlib.h>/************************************************************************/ /* 隊列結構要素&#xff1a;隊列容量 內存指針 元素個數 隊列頭 對列尾*/ /********************************************…

c++面向對象高級編程 學習八 non-explicit-one-argement-ctor

explicit&#xff08;顯式的&#xff09;&#xff1a;作用是"禁止單參數構造函數"被用于自動類型轉換 non-explicit: class Fraction { public:Fraction(int num,int den1):m_numerator(num),m_denominator(den){}Fraction operator (const Fraction& f){retur…

操作系統 IO管理

學什么&#xff1f; I/O input / output 輸入&#xff1a;鼠標 鍵盤 手柄 觸摸屏 攝像頭 MTC 掃描儀輸出&#xff1a;顯示器 打印機 耳機 音響 既是輸入也是輸出&#xff1a;光驅 網卡 磁盤 U盤硬件&#xff1a;設備如何把數據返回到PC機&#xff0c;但是不同種類的設…

英語口語小組PPT--袁隆平

文章中文版 大家好,我是第一組的xxx,現在由我來為大家分享在我眼中的袁隆平.在我看來,他值得外界對他的稱贊,因為他對中國,對世界的貢獻是有目共睹的:他研發的雜交水稻解決了人民的溫飽問題,讓無數人享受到吃飽的幸福&#xff0c;看到了生活的希望.這足以讓他青史留名. 并且他…

c++面向對象高級編程 學習九 pointer-like classes

c的class設計出來有兩種形式&#xff0c;一種像指針&#xff0c;一種像函數 智能指針里包含普通指針&#xff0c;要寫 * 和 -> 的函數 sp->method(); //sp-> 經 T* operator*() const 函數&#xff0c;得到px //由于 箭頭符號&#xff08;->&#xff09;作用下去…

const int *a和int*const a 的區別詳解

補充知識 “const int i”與“int const i”之間的區別對變量來說&#xff0c;const 關鍵字可以限定一個變量的值不允許改變&#xff0c;從而保護被修飾的東西&#xff0c;防止意外修改&#xff0c;在一定程度上可以提高程序的安全性和可靠性。 代碼 const int * int i1 10…