Light oj -1241 - Pinocchio sollution

#include<bits/stdc++.h> using namespace std; int main() { long long int i,j,k,t,n,m,f,a,p; cin>>t; for(i=1; i<=t; i++) { cin>>n; f=0; for(j=1; j<=n; j++) { cin>>a; if(j==1) { f+=ceil((a-2)/5.0); // normal nose size=2 so for present state nose is a-2; and count how many lies he told p=a; // present state } else { f+=ceil((a-p)/5.0); // false counting p=a; } } cout<<"Case "<<i<<": "<<f<<endl; } return 0; }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.