Var f:text; s:string; i,slo,ks:integer; k:real; begin assign(f,'text.in'); reset(f); while not Eof(f) do read(f,s); close(f); slo:=0; ks:=0; for i:=1 to length(s) do if s[i] in t then inc(slo) else begin; k:=k+slo; inc(ks); slo:=0; end; if s[length(s)] in t then begin; inc(ks); k:=k+slo; end; k:=k/ks; assign(f,'text.out'); rewrite(f); write(f,k); close(f); end.
Пример ввода(text.in): SIMPLE text Пример вывода(text.out): 5
Ответить на вопрос
Поделитесь своими знаниями, ответьте на вопрос:
Дано масив з 5 елементів вивести всі від'ємні елементи масиву
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <cstring>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <climits>typedef unsigned long long ulol;
typedef long long lol;
typedef long int li;#define mp make_pair
#define F first
#define S second
#define sqr(a) ( (a) * (a) )
#define pb push_back
#define INF 999999999
#define ret(a) cout << endl; system("pause"); return(a)
//#define ret(a) return(a)using namespace std;int main()
{
string s;
cin >> s;
cout << 1 << s << 1;
ret(0);
}